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

import java.util.HashMap;
import java.util.List;
import java.util.concurrent.Callable;

/* JADX INFO: loaded from: classes2.dex */
public final class ua extends j {

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

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

    public ua(s6 s6Var) {
        super("require");
        this.f20482d = new HashMap();
        this.f20481c = s6Var;
    }

    @Override // com.google.android.gms.internal.measurement.j
    public final n a(u.e eVar, List list) {
        n nVar;
        y5.p(1, list, "require");
        String strZzf = eVar.q((n) list.get(0)).zzf();
        HashMap map = this.f20482d;
        if (map.containsKey(strZzf)) {
            return (n) map.get(strZzf);
        }
        s6 s6Var = this.f20481c;
        if (s6Var.f20410a.containsKey(strZzf)) {
            try {
                nVar = (n) ((Callable) s6Var.f20410a.get(strZzf)).call();
            } catch (Exception unused) {
                throw new IllegalStateException(defpackage.e.i("Failed to create API implementation: ", strZzf));
            }
        } else {
            nVar = n.f20321v;
        }
        if (nVar instanceof j) {
            map.put(strZzf, (j) nVar);
        }
        return nVar;
    }
}
