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

import android.content.Context;
import android.net.Uri;
import android.text.TextUtils;
import java.util.HashMap;
import java.util.Map;

/* JADX INFO: loaded from: classes2.dex */
public abstract class xs {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final ns f18535a = new ns(12);

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final ns f18536b = new ns(13);

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static final ns f18537c = new ns(14);

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final ns f18538d = new ns(15);

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static final ns f18539e = new ns(16);

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static final ns f18540f = new ns(17);

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public static final o40 f18541g = new o40();

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public static final ns f18542h = new ns(20);

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public static final ms f18543i = new ms();

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public static final gn0 f18544j = new gn0();

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public static final ns f18545k = new ns(18);

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public static final ns f18546l = new ns(19);

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public static final ns f18547m = new ns(0);

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public static final ns f18548n = new ns(1);

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public static final ns f18549o = new ns(2);

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public static final ns f18550p = new ns(3);

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public static final ns f18551q = new ns(4);

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public static final ns f18552r = new ns(5);

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public static final ns f18553s = new ns(6);

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public static final ns f18554t = new ns(7);

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public static final ns f18555u = new ns(8);

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public static final ns f18556v = new ns(9);

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public static final ns f18557w = new ns(10);

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public static final ns f18558x = new ns(11);

    public static com.google.common.util.concurrent.w a(x50 x50Var, String str) {
        y10 y10Var;
        String strZzj;
        String strReplace;
        Uri uriB = Uri.parse(str);
        try {
            tg tgVarZ = x50Var.z();
            kb1 kb1VarI0 = x50Var.i0();
            if (!((Boolean) n7.y.f31093e.f31096c.b(ao.f8924jd)).booleanValue() || kb1VarI0 == null) {
                if (tgVarZ != null && tgVarZ.a(uriB)) {
                    uriB = tgVarZ.b(uriB, x50Var.getContext(), x50Var.o(), x50Var.zzj());
                }
            } else if (tgVarZ != null && tgVarZ.a(uriB)) {
                uriB = kb1VarI0.zza(uriB, x50Var.getContext(), x50Var.o(), x50Var.zzj());
            }
        } catch (zzazi unused) {
            q7.j.d("Unable to append parameter to URL: ".concat(str));
        }
        HashMap map = new HashMap();
        if (x50Var.zzC() != null) {
            map = x50Var.zzC().f18004q0;
        }
        Context context = x50Var.getContext();
        m7.n nVar = m7.n.C;
        if (nVar.f30486y.a(context) && (strZzj = (y10Var = nVar.f30486y).zzj(context)) != null) {
            tn tnVar = ao.H0;
            n7.y yVar = n7.y.f31093e;
            String str2 = (String) yVar.f31096c.b(tnVar);
            String string = uriB.toString();
            tn tnVar2 = ao.G0;
            yn ynVar = yVar.f31096c;
            if (((Boolean) ynVar.b(tnVar2)).booleanValue() && string.contains(str2)) {
                y10Var.zzk(context, strZzj, (Map) map.get("_ac"));
                strReplace = ni.C(context, string).replace(str2, strZzj);
            } else if (!TextUtils.isEmpty(uriB.getQueryParameter("fbs_aeid")) || ((Boolean) ynVar.b(ao.F0)).booleanValue()) {
                strReplace = string;
            } else {
                String string2 = ni.w(ni.C(context, string), "fbs_aeid", strZzj).toString();
                y10Var.zzk(context, strZzj, (Map) map.get("_ac"));
                strReplace = string2;
            }
        } else {
            strReplace = uriB.toString();
        }
        long jLongValue = ((Long) np.f14683e.j()).longValue();
        if (jLongValue <= 0 || jLongValue > 254715000) {
            return ih1.k(strReplace);
        }
        wu1 wu1VarS = wu1.s(x50Var.L());
        rs rsVar = rs.f16210a;
        a30 a30Var = b30.f9365g;
        return ih1.U0(ih1.h1(ih1.U0(wu1VarS, Throwable.class, rsVar, a30Var), new ss(strReplace, 0), a30Var), Throwable.class, new ss(strReplace, 1), a30Var);
    }

    public static void b(Map map, fk0 fk0Var) {
        if (((Boolean) n7.y.f31093e.f31096c.b(ao.Wb)).booleanValue() && map.containsKey("sc") && ((String) map.get("sc")).equals("1") && fk0Var != null) {
            fk0Var.w();
        }
    }
}
