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

import android.app.Activity;
import android.content.Context;
import android.net.NetworkCapabilities;
import android.os.Build;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;

/* JADX INFO: loaded from: classes2.dex */
public final class sg extends rg {

    /* JADX INFO: renamed from: a0, reason: collision with root package name */
    public static final Object f16429a0 = new Object();

    /* JADX INFO: renamed from: b0, reason: collision with root package name */
    public static boolean f16430b0 = false;

    /* JADX INFO: renamed from: c0, reason: collision with root package name */
    public static long f16431c0;

    /* JADX INFO: renamed from: d0, reason: collision with root package name */
    public static xg f16432d0;

    /* JADX INFO: renamed from: e0, reason: collision with root package name */
    public static th f16433e0;

    /* JADX INFO: renamed from: f0, reason: collision with root package name */
    public static nh f16434f0;

    /* JADX INFO: renamed from: g0, reason: collision with root package name */
    public static vu0 f16435g0;

    /* JADX INFO: renamed from: h0, reason: collision with root package name */
    public static vg f16436h0;
    public final n5.s X;
    public rh Y;
    public final HashMap Z;

    public sg(Context context, n5.s sVar) {
        super(context);
        this.Z = new HashMap();
        this.X = sVar;
    }

    public static mh l(Context context, boolean z10) {
        if (rg.W == null) {
            synchronized (f16429a0) {
                try {
                    if (rg.W == null) {
                        mh mhVarA = mh.a(context, z10, f16436h0);
                        if (mhVarA.f14232n) {
                            try {
                                if (((Boolean) n7.y.f31093e.f31096c.b(ao.W3)).booleanValue()) {
                                    mhVarA.c("EG2NhqmkZH3IzxVQRUhlLPeSdGNOmVVMlZvdVRoPMeBX1YRu4M6S9HAWzARuGlrt", "rJ+3epX9GIWpiD23zEqB2nJ57HosctKKCexIQaNPOnU=", new Class[0]);
                                }
                            } catch (IllegalStateException unused) {
                            }
                            mhVarA.c("mKTuB4d9zL2gk2O79XsYpNB+aKHwN1U9hkAKPABelEWUf6fdcG0P932Axqt06R0v", "IhWvFwVDz7+S2dgPUyZdbvNgcZm/v4DQbcD3M8nxqCg=", Context.class);
                            tn tnVar = ao.f8833e4;
                            n7.y yVar = n7.y.f31093e;
                            if (((Boolean) yVar.f31096c.b(tnVar)).booleanValue()) {
                                mhVarA.c("r3bKg5w0nz7IjZtWNMiPOsvB0VlHAYkN7VnU6Stu7HeDf3C1E2T8lLdAdxjkOACh", "v3VfjQtThhKzeCR8emHmzxqnaN2SnNbSp/OAufPeGKA=", new Class[0]);
                            }
                            mhVarA.c("BJ0iIx7YCr6PyW+pyNNozQaB62BBi5nixFl6WJUaFdU4X2GlfptGfOLgFJ7ri6Ag", "ovMA5nrmsfMPPc1p4911nPRjAFxE4I+3QWZwZMrn+uQ=", Context.class);
                            mhVarA.c("t0O1yTkaf8U85RYVI/Iw764S7xVo2UnzoC6xqdKHezEduB25T+k9NlupfapwCNk2", "NAFu5DHVi3o3yaFx1OCpv/KBsMCIhscKWxn1MzThPRk=", Context.class);
                            mhVarA.c("1zgOnWB50YTfrYi7hohk1+6dBIPxt34hX6y8yjUFyxGuxbHgbh6iUx1TaFIrLKll", "2AwwIe7av6W3pdyOMr9aVntj24MOb2beINimmdYpluE=", Context.class);
                            mhVarA.c("KMUeaeNiUI6XsUYhfNNPM5hdqwDfiAVXu+jtj2XrbalwiO+unml0DNmATqQtDmlU", "B4oRQazYGo5C2idQuGW+PTqNOD34GvbDXi8fMMTvLXo=", Context.class);
                            Class cls = Boolean.TYPE;
                            mhVarA.c("Vt16THtmezzLb1zgD4XzuhSMrHLGIQcDJNqtzF8G+1UgPRnrYaZemyLPsebqTPQi", "+oRdA7B1eJk1uXzj6xFlex4QQoiHLhoEiFmCoqVQP54=", Context.class, cls);
                            mhVarA.c("WAcniJw/GaiqIp9OLpCOBQZL84JUYDjTztoPXXS1J2Z88XAmBTXkRw892qBHqVl7", "XsRFkPGR/9DtQdRlTgBn2CYNiaiyrwSr5Bve6m5X61U=", Context.class);
                            mhVarA.c("YcvOy2Y9scoLzd9aO/r1q51CuRDPgptfjUczBG/4u9TSMf5O8lCrtIMZ2+ctDcs+", "6V7/ExCl9vngHnxEtX1goXpmDP9bA02eRvmHfr0qsgM=", Context.class);
                            mhVarA.c("VBBl/RSrrbh4NuoCpwv4Ff9uwlR+nIgvPASME/UcMSWtAZ4zziFv8sIkhiXD3JGh", "adtakVLQMMHz1yZrv+u5ZZiabjtFTP38FJEsPLAtvHE=", MotionEvent.class, DisplayMetrics.class);
                            mhVarA.c("cyl6+Nm7z/4AUMU9zZ2TYBK+lMXXrSwSgLNSZTdnB4C/ax/Gmzarui2kcSD53JXu", "gJiy+5nUzzsm5alaQ5ciO1Z43m3zAJgcxxPvmvUS+Vo=", MotionEvent.class, DisplayMetrics.class);
                            mhVarA.c("KS95o7MbZWIdKuBkGY5EucArwEmarpDzvrPJlr4r6NTEwXHZ52g0Gof8SUaYNmWh", "sZhcPfATNezp7ZcisFX7I2sqsKQPBRrUcm6y3tpw6ig=", new Class[0]);
                            mhVarA.c("R0KTYl+9Bi7RshEQmYhK/YeVyfjIkHliDPJVeC+XBbAz0q1EMlAcoZ8JeP0fdmTX", "AARE3CI7+7Fq5atzy8wcVAJTjdNJGGNM3rGztRoG23E=", new Class[0]);
                            mhVarA.c("yZXKjkpxohkfNrA4/dntjy5UGv8pEqMsOsdSv+5n+sZgEYNlImB4QjlGv7rNs0BZ", "qPvuYJ0m6OwVM7zFkNMQ820WzknyvHgBl013Si7b8nM=", new Class[0]);
                            mhVarA.c("FynI9c5fEiMzQz2B7twhubBCGA6OmnD4m4mZd8FrJbuEtgSrrhq+E+F7XsfWYfqR", "1Y9Pw3JU+olt+lWU2l7rblcsXGsm1mQtokTJIYT27m0=", new Class[0]);
                            mhVarA.c("iVzH00FGTIijHIZ0HS5SItMsN9AyuHOn1xXwzbhHf6Eq/l9FiFSlfrw2j7G806j4", "RyZVSwEZZgeTR1V/DRrjgM5Yqk49vWkiFPpVljbz9Uo=", new Class[0]);
                            mhVarA.c("WpK2JUF8iJ/BvX1YbpvZEg/OwGEi7DqWo1w6qvQxAhqdLxv0KDJfeHynFcOHsF/r", "eAfiSXYP9RekAEzlsFTPbe7e0Y1hgLoRWRhxsNjDqkg=", new Class[0]);
                            mhVarA.c("ZQJAB1msowxCz8mqmvl8OKnBprztAFjM8nst6XEIBWdYMrqlQRx5Smd7STWtlGuv", "xxbBAKX4fynezd8sgu9AN42lCipqUqelmvdX3g0EV6w=", Context.class, cls, String.class);
                            mhVarA.c("TnO68f+IpvRRkyv0ANYwkK+/mU2YJddrRcZ9TNokdmi5eEzcRJBPehtgPhuxRZAE", "PILFsXLzYdqBxxfwB9b+jT5mnzLC4LU5UXMk7tC1zw8=", StackTraceElement[].class);
                            mhVarA.c("FW20C8Ai9koIlsaxQSE6ztByFAH2b9HaWXnzViOGstPwi5iqItbLmay/ubT2VSsg", "WvzwBqCGqiupQVgrtkQ81CPfk2zDbRT3OzniCOJeuxU=", View.class, DisplayMetrics.class, cls, cls);
                            mhVarA.c("bor0O3H3y0qG5UIppgg8bI1z9WuHvZ9oSRl8MpYl5RU5HMZyWKOlyAU+eSAgxME2", "IUDkN9+rDzK4GSONwoR6w/25ruQD7QnRgetY7oPkg7w=", Context.class, cls);
                            mhVarA.c("v55I7GonHWsamYbBtyIFKaZFQR/sofAKKTQsUzMKV1C6iCJ1v6Vqzq9x9meUl2ez", "Z7zWno+0eCAtcsPK71T7clKp8ZTgICQrdpeo5cTQYQo=", View.class, Activity.class, cls);
                            mhVarA.c("X3d3ekEggpPfZcTTuZPSKX+MUCnQGNsbyccHnkW7iVTfczCTjKoxcgVjpAE8Uhyz", "I4rncSeVGoKv0gEJ8Xd0rq9G0kL2Ky2ley3iuTG83Dg=", Long.TYPE);
                            mhVarA.c("x/S3A4n6lbyzTdn/kz8tPqUf3a1YB5vAd5r7wQYCBb3DYPiGQZB67fbWL/+XFcZ5", "kB0lJ6HHV2i/5ncg76cGz3oLPH/Yq3P6CviApgv8Ipc=", new Class[0]);
                            try {
                                if (((Boolean) yVar.f31096c.b(ao.Z3)).booleanValue()) {
                                    mhVarA.c("EHHl2bnow3CY535hCiXXbLjuydxFlVXitu9AIkBq9ZFdEOrgtrbiSayxFpjmKRmo", "ioEU79oGVeaIBBGOjKcBP85gZ/aumGq7/t+0LJZeQ5M=", Context.class);
                                }
                            } catch (IllegalStateException unused2) {
                            }
                            mhVarA.c("9zQJNYPRQu7M2PxsR2X5pUd2hUmUxo++JOxzNqkh3zn646wyxpHEbvjQqLWoAge2", "vZPGoOEoDBpprn4Bn8baCi1LGHgj6zo4y/AsLq2W9n8=", Context.class);
                            try {
                                if (Build.VERSION.SDK_INT >= 26) {
                                    if (((Boolean) n7.y.f31093e.f31096c.b(ao.f8766a4)).booleanValue()) {
                                        Class cls2 = Long.TYPE;
                                        mhVarA.c("MHYgRB9ZLJ711MlDBgDgyPDdkDVVlHwuqDeF/1i1ByNixJnhURH1lj12DYAv6vPJ", "+dsC4zlVzClLb/gffysp/RM/1OAwcqKcuzzXTv3qmQk=", NetworkCapabilities.class, cls2, cls2);
                                    }
                                }
                            } catch (IllegalStateException unused3) {
                            }
                            try {
                                if (((Boolean) n7.y.f31093e.f31096c.b(ao.f9064s3)).booleanValue()) {
                                    mhVarA.c("mt+WJZ1rsk0A64GmF9v+ldp/SXHcK6tYIctDM1+NeYG+QzoGvdHV21P9oFWIcCVk", "JGpzBcqG4jzyQyzoEbT5NvLNZXRWAW3o2QUKET83n6Q=", List.class);
                                }
                            } catch (IllegalStateException unused4) {
                            }
                            if (((Boolean) n7.y.f31093e.f31096c.b(ao.f8914j3)).booleanValue()) {
                                Class cls3 = Long.TYPE;
                                mhVarA.c("uAqKAtpzCVdzsQfO3VsjAegcR1bzJIPV7WnBpdLTTlepVA45FMcx2CHHUDw9JuIC", "/PvocKqER/fglRgbozHO01MU+uyxr0WG8/b5JQrvhOY=", cls3, cls3, cls3, cls3);
                            } else {
                                try {
                                    if (((Boolean) n7.y.f31093e.f31096c.b(ao.f8898i3)).booleanValue()) {
                                        mhVarA.c("mWKvHkCTlhia7UFG1tX8rmkp9AizD6H5C2Y+fxk0U+Y2fZze528QNyV6FTMftwOj", "NhSpQvE4PaXaFqOsSIcuQESqMAyvT+VdhFhpwrR61iU=", long[].class, Context.class, View.class);
                                    }
                                } catch (IllegalStateException unused5) {
                                }
                            }
                        }
                        rg.W = mhVarA;
                    }
                } finally {
                }
            }
        }
        return rg.W;
    }

    public static oh m(mh mhVar, MotionEvent motionEvent, DisplayMetrics displayMetrics) throws zzbaa {
        Method methodD = mhVar.d("VBBl/RSrrbh4NuoCpwv4Ff9uwlR+nIgvPASME/UcMSWtAZ4zziFv8sIkhiXD3JGh", "adtakVLQMMHz1yZrv+u5ZZiabjtFTP38FJEsPLAtvHE=");
        if (methodD == null || motionEvent == null) {
            throw new zzbaa();
        }
        try {
            return new oh((String) methodD.invoke(null, motionEvent, displayMetrics));
        } catch (IllegalAccessException | InvocationTargetException e10) {
            throw new zzbaa(e10);
        }
    }

    public static final void o(List list) {
        ExecutorService executorService;
        if (rg.W == null || (executorService = rg.W.f14220b) == null || list.isEmpty()) {
            return;
        }
        try {
            executorService.invokeAll(list, ((Long) n7.y.f31093e.f31096c.b(ao.f8832e3)).longValue(), TimeUnit.MILLISECONDS);
        } catch (InterruptedException e10) {
            char[] cArr = ph.f15417a;
            StringWriter stringWriter = new StringWriter();
            e10.printStackTrace(new PrintWriter(stringWriter));
            String.format("class methods got exception: %s", stringWriter.toString());
        }
    }

    @Override // com.google.android.gms.internal.ads.rg
    public final we e(Context context) {
        ArrayList arrayList;
        we weVar;
        long j10;
        th thVar = f16433e0;
        if (thVar != null && thVar.f16898d) {
            thVar.f16896b = System.currentTimeMillis();
        }
        tn tnVar = ao.f8914j3;
        n7.y yVar = n7.y.f31093e;
        if (((Boolean) yVar.f31096c.b(tnVar)).booleanValue()) {
            nh nhVar = f16434f0;
            nhVar.f14600b = nhVar.f14599a;
            nhVar.f14599a = SystemClock.uptimeMillis();
        }
        we weVarD0 = pf.D0();
        n5.s sVar = this.X;
        String str = (String) sVar.f30880b;
        if (!TextUtils.isEmpty(str)) {
            weVarD0.c();
            ((pf) weVarD0.f8617b).G0(str);
        }
        mh mhVarL = l(context, sVar.f30879a);
        if (mhVarL.f14220b == null) {
            return weVarD0;
        }
        int iE = mhVarL.e();
        ArrayList arrayList2 = new ArrayList();
        if (mhVarL.f14232n) {
            arrayList2.add(new xh(mhVarL, weVarD0, iE, context, (qe) sVar.f30881c, f16435g0));
            arrayList = arrayList2;
            arrayList.add(new ai(mhVarL, weVarD0, f16431c0, iE));
            arrayList.add(new gi(mhVarL, weVarD0, iE));
            arrayList.add(new uh(mhVarL, weVarD0, iE, context));
            arrayList.add(new ji(mhVarL, weVarD0, iE));
            arrayList.add(new wh(mhVarL, weVarD0, iE, context));
            arrayList.add(new vh(mhVarL, weVarD0, iE, 2));
            arrayList.add(new vh(mhVarL, weVarD0, iE, 4));
            arrayList.add(new vh(mhVarL, weVarD0, iE, 5));
            arrayList.add(new zh(mhVarL, weVarD0, iE));
            arrayList.add(new ei(mhVarL, weVarD0, iE));
            arrayList.add(new vh(mhVarL, weVarD0, iE, 8));
            arrayList.add(new vh(mhVarL, weVarD0, iE, 1));
            arrayList.add(new vh(mhVarL, weVarD0, iE, 7));
            arrayList.add(new hi(mhVarL, weVarD0, iE));
            tn tnVar2 = ao.f8766a4;
            yn ynVar = yVar.f31096c;
            if (((Boolean) ynVar.b(tnVar2)).booleanValue()) {
                th thVar2 = f16433e0;
                long j11 = -1;
                if (thVar2 != null) {
                    long j12 = thVar2.f16898d ? thVar2.f16896b - thVar2.f16895a : -1L;
                    long j13 = thVar2.f16897c;
                    thVar2.f16897c = -1L;
                    j11 = j12;
                    j10 = j13;
                } else {
                    j10 = -1;
                }
                weVar = weVarD0;
                arrayList.add(new fi(mhVarL, weVarD0, iE, f16432d0, j11, j10));
            } else {
                weVar = weVarD0;
            }
            if (((Boolean) ynVar.b(ao.Z3)).booleanValue()) {
                arrayList.add(new vh(mhVarL, weVar, iE, 6));
            }
            arrayList.add(new vh(mhVarL, weVar, iE, 3));
            if (((Boolean) ynVar.b(ao.f8816d4)).booleanValue()) {
                arrayList.add(new vh(mhVarL, weVar, iE, 0));
            }
            if (((Boolean) ynVar.b(ao.f8833e4)).booleanValue()) {
                arrayList.add(new bi(mhVarL, "r3bKg5w0nz7IjZtWNMiPOsvB0VlHAYkN7VnU6Stu7HeDf3C1E2T8lLdAdxjkOACh", "v3VfjQtThhKzeCR8emHmzxqnaN2SnNbSp/OAufPeGKA=", weVar, iE, 82));
            }
        } else {
            weVarD0.h(16384L);
            arrayList = arrayList2;
            weVar = weVarD0;
        }
        o(arrayList);
        return weVar;
    }

    @Override // com.google.android.gms.internal.ads.rg
    public final we f(Context context, View view, Activity activity) {
        th thVar = f16433e0;
        if (thVar != null && thVar.f16898d) {
            thVar.f16896b = System.currentTimeMillis();
        }
        if (((Boolean) n7.y.f31093e.f31096c.b(ao.f8914j3)).booleanValue()) {
            nh nhVar = f16434f0;
            nhVar.f14606h = nhVar.f14605g;
            nhVar.f14605g = SystemClock.uptimeMillis();
        }
        we weVarD0 = pf.D0();
        n5.s sVar = this.X;
        String str = (String) sVar.f30880b;
        if (!TextUtils.isEmpty(str)) {
            weVarD0.c();
            ((pf) weVarD0.f8617b).G0(str);
        }
        n(l(context, sVar.f30879a), weVarD0, view, activity, true, context);
        return weVarD0;
    }

    @Override // com.google.android.gms.internal.ads.rg
    public final we g(Context context, View view, Activity activity) {
        th thVar = f16433e0;
        if (thVar != null && thVar.f16898d) {
            thVar.f16896b = System.currentTimeMillis();
        }
        if (((Boolean) n7.y.f31093e.f31096c.b(ao.f8914j3)).booleanValue()) {
            f16434f0.a(context, view);
        }
        we weVarD0 = pf.D0();
        n5.s sVar = this.X;
        String str = (String) sVar.f30880b;
        weVarD0.c();
        ((pf) weVarD0.f8617b).G0(str);
        n(l(context, sVar.f30879a), weVarD0, view, activity, false, context);
        return weVarD0;
    }

    @Override // com.google.android.gms.internal.ads.rg
    public final oh h(MotionEvent motionEvent) throws zzbaa {
        Method methodD = rg.W.d("cyl6+Nm7z/4AUMU9zZ2TYBK+lMXXrSwSgLNSZTdnB4C/ax/Gmzarui2kcSD53JXu", "gJiy+5nUzzsm5alaQ5ciO1Z43m3zAJgcxxPvmvUS+Vo=");
        if (methodD == null || motionEvent == null) {
            throw new zzbaa();
        }
        try {
            return new oh((String) methodD.invoke(null, motionEvent, this.V));
        } catch (IllegalAccessException | InvocationTargetException e10) {
            throw new zzbaa(e10);
        }
    }

    @Override // com.google.android.gms.internal.ads.rg
    public final long i(StackTraceElement[] stackTraceElementArr) throws zzbaa {
        Method methodD = rg.W.d("TnO68f+IpvRRkyv0ANYwkK+/mU2YJddrRcZ9TNokdmi5eEzcRJBPehtgPhuxRZAE", "PILFsXLzYdqBxxfwB9b+jT5mnzLC4LU5UXMk7tC1zw8=");
        if (methodD == null || stackTraceElementArr == null) {
            throw new zzbaa();
        }
        try {
            return new wg((String) methodD.invoke(null, stackTraceElementArr), 1).f18041b.longValue();
        } catch (IllegalAccessException | InvocationTargetException e10) {
            throw new zzbaa(e10);
        }
    }

    public final void n(mh mhVar, we weVar, View view, Activity activity, boolean z10, Context context) {
        n7.y yVar;
        ArrayList arrayList;
        int i10;
        long j10;
        long j11;
        List listAsList;
        MotionEvent motionEvent;
        int i11 = 1;
        if (mhVar.f14232n) {
            synchronized (this) {
                try {
                    try {
                        oh ohVarM = m(mhVar, this.f16118a, this.V);
                        Long l10 = ohVarM.f15063a;
                        if (l10 != null) {
                            long jLongValue = l10.longValue();
                            weVar.c();
                            ((pf) weVar.f8617b).M0(jLongValue);
                        }
                        Long l11 = ohVarM.f15064b;
                        if (l11 != null) {
                            long jLongValue2 = l11.longValue();
                            weVar.c();
                            ((pf) weVar.f8617b).N0(jLongValue2);
                        }
                        Long l12 = ohVarM.f15065c;
                        if (l12 != null) {
                            long jLongValue3 = l12.longValue();
                            weVar.c();
                            ((pf) weVar.f8617b).O0(jLongValue3);
                        }
                        if (this.U) {
                            Long l13 = ohVarM.f15066d;
                            if (l13 != null) {
                                long jLongValue4 = l13.longValue();
                                weVar.c();
                                ((pf) weVar.f8617b).H(jLongValue4);
                            }
                            Long l14 = ohVarM.f15067e;
                            if (l14 != null) {
                                long jLongValue5 = l14.longValue();
                                weVar.c();
                                ((pf) weVar.f8617b).I(jLongValue5);
                            }
                        }
                    } catch (zzbaa unused) {
                    }
                    lf lfVarB = mf.B();
                    if (this.f16120c > 0) {
                        DisplayMetrics displayMetrics = this.V;
                        char[] cArr = ph.f15417a;
                        if (displayMetrics != null && displayMetrics.density != 0.0f) {
                            long jC = ph.c(this.f16127j, displayMetrics);
                            lfVarB.c();
                            ((mf) lfVarB.f8617b).N(jC);
                            long jC2 = ph.c(this.R - this.f16130m, this.V);
                            lfVarB.c();
                            ((mf) lfVarB.f8617b).O(jC2);
                            long jC3 = ph.c(this.S - this.Q, this.V);
                            lfVarB.c();
                            ((mf) lfVarB.f8617b).P(jC3);
                            long jC4 = ph.c(this.f16130m, this.V);
                            lfVarB.c();
                            ((mf) lfVarB.f8617b).S(jC4);
                            long jC5 = ph.c(this.Q, this.V);
                            lfVarB.c();
                            ((mf) lfVarB.f8617b).T(jC5);
                            if (this.U && (motionEvent = this.f16118a) != null) {
                                long jC6 = ph.c(((this.f16130m - this.R) + motionEvent.getRawX()) - this.f16118a.getX(), this.V);
                                if (jC6 != 0) {
                                    lfVarB.c();
                                    ((mf) lfVarB.f8617b).Q(jC6);
                                }
                                long jC7 = ph.c(((this.Q - this.S) + this.f16118a.getRawY()) - this.f16118a.getY(), this.V);
                                if (jC7 != 0) {
                                    lfVarB.c();
                                    ((mf) lfVarB.f8617b).R(jC7);
                                }
                            }
                        }
                    }
                    try {
                        oh ohVarH = h(this.f16118a);
                        Long l15 = ohVarH.f15063a;
                        if (l15 != null) {
                            long jLongValue6 = l15.longValue();
                            lfVarB.c();
                            ((mf) lfVarB.f8617b).C(jLongValue6);
                        }
                        Long l16 = ohVarH.f15064b;
                        if (l16 != null) {
                            long jLongValue7 = l16.longValue();
                            lfVarB.c();
                            ((mf) lfVarB.f8617b).D(jLongValue7);
                        }
                        long jLongValue8 = ohVarH.f15065c.longValue();
                        lfVarB.c();
                        ((mf) lfVarB.f8617b).J(jLongValue8);
                        if (this.U) {
                            Long l17 = ohVarH.f15067e;
                            if (l17 != null) {
                                long jLongValue9 = l17.longValue();
                                lfVarB.c();
                                ((mf) lfVarB.f8617b).E(jLongValue9);
                            }
                            Long l18 = ohVarH.f15066d;
                            if (l18 != null) {
                                long jLongValue10 = l18.longValue();
                                lfVarB.c();
                                ((mf) lfVarB.f8617b).H(jLongValue10);
                            }
                            Long l19 = ohVarH.f15068f;
                            if (l19 != null) {
                                int i12 = l19.longValue() != 0 ? 2 : 1;
                                lfVarB.c();
                                ((mf) lfVarB.f8617b).U(i12);
                            }
                            long j12 = this.f16121d;
                            if (j12 > 0) {
                                DisplayMetrics displayMetrics2 = this.V;
                                char[] cArr2 = ph.f15417a;
                                Long lValueOf = (displayMetrics2 == null || displayMetrics2.density == 0.0f) ? null : Long.valueOf(Math.round(this.f16126i / j12));
                                if (lValueOf != null) {
                                    long jLongValue11 = lValueOf.longValue();
                                    lfVarB.c();
                                    ((mf) lfVarB.f8617b).F(jLongValue11);
                                } else {
                                    lfVarB.c();
                                    ((mf) lfVarB.f8617b).G();
                                }
                                long jRound = Math.round(this.f16125h / this.f16121d);
                                lfVarB.c();
                                ((mf) lfVarB.f8617b).I(jRound);
                            }
                            Long l20 = ohVarH.f15071i;
                            if (l20 != null) {
                                long jLongValue12 = l20.longValue();
                                lfVarB.c();
                                ((mf) lfVarB.f8617b).L(jLongValue12);
                            }
                            Long l21 = ohVarH.f15072j;
                            if (l21 != null) {
                                long jLongValue13 = l21.longValue();
                                lfVarB.c();
                                ((mf) lfVarB.f8617b).K(jLongValue13);
                            }
                            Long l22 = ohVarH.f15073k;
                            if (l22 != null) {
                                int i13 = l22.longValue() != 0 ? 2 : 1;
                                lfVarB.c();
                                ((mf) lfVarB.f8617b).V(i13);
                            }
                        }
                    } catch (zzbaa unused2) {
                    }
                    long j13 = this.f16124g;
                    if (j13 > 0) {
                        lfVarB.c();
                        ((mf) lfVarB.f8617b).M(j13);
                    }
                    mf mfVar = (mf) lfVarB.e();
                    weVar.c();
                    ((pf) weVar.f8617b).U(mfVar);
                    long j14 = this.f16120c;
                    if (j14 > 0) {
                        weVar.c();
                        ((pf) weVar.f8617b).L(j14);
                    }
                    long j15 = this.f16121d;
                    if (j15 > 0) {
                        weVar.c();
                        ((pf) weVar.f8617b).K(j15);
                    }
                    long j16 = this.f16122e;
                    if (j16 > 0) {
                        weVar.c();
                        ((pf) weVar.f8617b).J(j16);
                    }
                    long j17 = this.f16123f;
                    if (j17 > 0) {
                        weVar.c();
                        ((pf) weVar.f8617b).M(j17);
                    }
                    try {
                        LinkedList linkedList = this.f16119b;
                        int size = linkedList.size() - 1;
                        if (size > 0) {
                            weVar.c();
                            ((pf) weVar.f8617b).W();
                            for (int i14 = 0; i14 < size; i14++) {
                                oh ohVarM2 = m(rg.W, (MotionEvent) linkedList.get(i14), this.V);
                                lf lfVarB2 = mf.B();
                                long jLongValue14 = ohVarM2.f15063a.longValue();
                                lfVarB2.c();
                                ((mf) lfVarB2.f8617b).C(jLongValue14);
                                long jLongValue15 = ohVarM2.f15064b.longValue();
                                lfVarB2.c();
                                ((mf) lfVarB2.f8617b).D(jLongValue15);
                                mf mfVar2 = (mf) lfVarB2.e();
                                weVar.c();
                                ((pf) weVar.f8617b).V(mfVar2);
                            }
                        }
                    } catch (zzbaa unused3) {
                        weVar.c();
                        ((pf) weVar.f8617b).W();
                    }
                } catch (Throwable th) {
                    throw th;
                }
            }
            ArrayList arrayList2 = new ArrayList();
            if (mhVar.f14220b == null) {
                arrayList = arrayList2;
            } else {
                int iE = mhVar.e();
                tn tnVar = ao.f9048r3;
                n7.y yVar2 = n7.y.f31093e;
                if (((Boolean) yVar2.f31096c.b(tnVar)).booleanValue()) {
                    yVar = yVar2;
                    arrayList2.add(new xh(mhVar, weVar, iE, context, (qe) this.X.f30881c, f16435g0));
                    arrayList2.add(new wh(mhVar, weVar, iE, context));
                    arrayList2.add(new uh(mhVar, weVar, iE, context));
                    arrayList2.add(new ji(mhVar, weVar, iE));
                    th thVar = f16433e0;
                    if (thVar != null) {
                        long j18 = thVar.f16898d ? thVar.f16896b - thVar.f16895a : -1L;
                        long j19 = thVar.f16897c;
                        thVar.f16897c = -1L;
                        j11 = j19;
                        j10 = j18;
                    } else {
                        j10 = -1;
                        j11 = -1;
                    }
                    arrayList = arrayList2;
                    i10 = iE;
                    arrayList.add(new fi(mhVar, weVar, iE, f16432d0, j10, j11));
                    arrayList.add(new vh(mhVar, weVar, i10, 6));
                } else {
                    yVar = yVar2;
                    arrayList = arrayList2;
                    i10 = iE;
                }
                arrayList.add(new hg(mhVar, weVar, 1));
                arrayList.add(new gi(mhVar, weVar, i10));
                arrayList.add(new ai(mhVar, weVar, f16431c0, i10));
                arrayList.add(new zh(mhVar, weVar, i10));
                arrayList.add(new vh(mhVar, weVar, i10, 4));
                arrayList.add(new vh(mhVar, weVar, i10, 5));
                arrayList.add(new ei(mhVar, weVar, i10));
                arrayList.add(new vh(mhVar, weVar, i10, 2));
                arrayList.add(new vh(mhVar, weVar, i10, 8));
                arrayList.add(new vh(mhVar, weVar, i10, 1));
                arrayList.add(new vh(mhVar, weVar, i10, 7));
                arrayList.add(new ci(mhVar, weVar, i10, new Throwable().getStackTrace()));
                arrayList.add(new ci(mhVar, weVar, i10, view));
                arrayList.add(new hi(mhVar, weVar, i10));
                n7.y yVar3 = yVar;
                if (((Boolean) yVar3.f31096c.b(ao.f8849f3)).booleanValue()) {
                    arrayList.add(new uh(mhVar, weVar, i10, view, activity));
                }
                if (((Boolean) yVar3.f31096c.b(ao.f8816d4)).booleanValue()) {
                    arrayList.add(new vh(mhVar, weVar, i10, 0));
                }
                if (!z10) {
                    try {
                        if (((Boolean) yVar3.f31096c.b(ao.f8898i3)).booleanValue()) {
                            arrayList.add(new di(mhVar, weVar, i10, this.Z, view, context));
                        }
                    } catch (IllegalStateException unused4) {
                    }
                    try {
                        if (((Boolean) n7.y.f31093e.f31096c.b(ao.f8914j3)).booleanValue()) {
                            arrayList.add(new ci(mhVar, weVar, i10, f16434f0));
                        }
                    } catch (IllegalStateException unused5) {
                    }
                    if (((Boolean) n7.y.f31093e.f31096c.b(ao.f9064s3)).booleanValue()) {
                        arrayList.add(new ci(mhVar, weVar, i10, this.zzr));
                    }
                } else if (((Boolean) yVar3.f31096c.b(ao.f8882h3)).booleanValue()) {
                    arrayList.add(new ii(mhVar, weVar, i10, this.Y));
                }
            }
            listAsList = arrayList;
        } else {
            weVar.h(16384L);
            listAsList = Arrays.asList(new hg(mhVar, weVar, i11));
        }
        o(listAsList);
    }

    @Override // com.google.android.gms.internal.ads.qg
    public final void zzh(View view) {
        if (((Boolean) n7.y.f31093e.f31096c.b(ao.f8882h3)).booleanValue()) {
            if (this.Y == null) {
                mh mhVar = rg.W;
                this.Y = new rh(mhVar.f14219a, mhVar.f14233o);
            }
            this.Y.a(view);
        }
    }
}
