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

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

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ int f20235c = 3;

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

    public i6(com.google.android.gms.measurement.internal.h hVar) {
        super("internal.logger");
        this.f20236d = hVar;
        HashMap map = this.f20246b;
        map.put("log", new ta(this, false, true));
        map.put("silent", new b("silent", 2));
        ((j) map.get("silent")).c("log", new ta(this, true, true));
        map.put("unmonitored", new b("unmonitored", 3));
        ((j) map.get("unmonitored")).c("log", new ta(this, false, false));
    }

    @Override // com.google.android.gms.internal.measurement.j
    public final n a(u.e eVar, List list) {
        TreeMap treeMap;
        t tVar = n.f20321v;
        String str = null;
        int i10 = this.f20235c;
        String str2 = this.f20245a;
        switch (i10) {
            case 0:
                y5.p(3, list, str2);
                String strZzf = eVar.q((n) list.get(0)).zzf();
                long jA = (long) y5.a(eVar.q((n) list.get(1)).zze().doubleValue());
                n nVarQ = eVar.q((n) list.get(2));
                HashMap mapO = nVarQ instanceof m ? y5.o((m) nVarQ) : new HashMap();
                xyz.stream.utils.t tVar2 = (xyz.stream.utils.t) this.f20236d;
                tVar2.getClass();
                HashMap map = new HashMap();
                for (String str3 : mapO.keySet()) {
                    HashMap map2 = ((c) tVar2.f36172b).f20137c;
                    map.put(str3, c.a(map2.containsKey(str3) ? map2.get(str3) : null, mapO.get(str3), str3));
                }
                ((List) tVar2.f36173c).add(new c(strZzf, map, jA));
                return tVar;
            case 1:
                y5.p(2, list, "getValue");
                n nVarQ2 = eVar.q((n) list.get(0));
                n nVarQ3 = eVar.q((n) list.get(1));
                String strZzf2 = nVarQ2.zzf();
                com.google.android.gms.measurement.internal.a aVar = (com.google.android.gms.measurement.internal.a) this.f20236d;
                Map map3 = (Map) ((com.google.android.gms.measurement.internal.e1) aVar.f21467c).f21548d.get((String) aVar.f21466b);
                if (map3 != null && map3.containsKey(strZzf2)) {
                    str = (String) map3.get(strZzf2);
                }
                return str != null ? new p(str) : nVarQ3;
            case 2:
                return tVar;
            case 3:
                y5.p(3, list, str2);
                eVar.q((n) list.get(0)).zzf();
                n nVarQ4 = eVar.q((n) list.get(1));
                if (!(nVarQ4 instanceof o)) {
                    throw new IllegalArgumentException("Invalid callback type");
                }
                n nVarQ5 = eVar.q((n) list.get(2));
                if (!(nVarQ5 instanceof m)) {
                    throw new IllegalArgumentException("Invalid callback params");
                }
                m mVar = (m) nVarQ5;
                if (!mVar.f20302a.containsKey("type")) {
                    throw new IllegalArgumentException("Undefined rule type");
                }
                String strZzf3 = mVar.zza("type").zzf();
                int iB = mVar.f20302a.containsKey("priority") ? y5.B(mVar.zza("priority").zze().doubleValue()) : 1000;
                z4 z4Var = (z4) this.f20236d;
                o oVar = (o) nVarQ4;
                z4Var.getClass();
                if ("create".equals(strZzf3)) {
                    treeMap = (TreeMap) z4Var.f20552b;
                } else {
                    if (!"edit".equals(strZzf3)) {
                        throw new IllegalStateException(defpackage.e.i("Unknown callback type: ", strZzf3));
                    }
                    treeMap = (TreeMap) z4Var.f20551a;
                }
                if (treeMap.containsKey(Integer.valueOf(iB))) {
                    iB = ((Integer) treeMap.lastKey()).intValue() + 1;
                }
                treeMap.put(Integer.valueOf(iB), oVar);
                return tVar;
            default:
                try {
                    return y5.j(((Callable) this.f20236d).call());
                } catch (Exception unused) {
                    return tVar;
                }
        }
    }

    public i6(com.google.android.gms.measurement.internal.d1 d1Var) {
        super("internal.appMetadata");
        this.f20236d = d1Var;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public i6(com.google.android.gms.measurement.internal.a aVar) {
        super("getValue");
        this.f20236d = aVar;
    }

    public i6(xyz.stream.utils.t tVar) {
        super("internal.eventLogger");
        this.f20236d = tVar;
    }

    public i6(z4 z4Var) {
        super("internal.registerCallback");
        this.f20236d = z4Var;
    }
}
