package m4;

import a.AbstractC0872a;
import com.revenuecat.purchases.common.diagnostics.DiagnosticsEntry;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/* JADX INFO: loaded from: classes3.dex */
public final class Y0 {

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

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

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

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

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

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

    public Y0(W0 w02, HashMap map, HashMap map2, Q1 q12, Object obj, Map map3) {
        this.f20914a = w02;
        this.f20915b = Collections.unmodifiableMap(new HashMap(map));
        this.f20916c = Collections.unmodifiableMap(new HashMap(map2));
        this.f20917d = q12;
        this.f20918e = obj;
        this.f20919f = map3 != null ? Collections.unmodifiableMap(new HashMap(map3)) : null;
    }

    public static Y0 a(Map map, boolean z6, int i6, int i7, Object obj) {
        Q1 q12;
        Map mapG;
        Q1 q13;
        if (z6) {
            if (map == null || (mapG = AbstractC2557x0.g("retryThrottling", map)) == null) {
                q13 = null;
            } else {
                float fFloatValue = AbstractC2557x0.e("maxTokens", mapG).floatValue();
                float fFloatValue2 = AbstractC2557x0.e("tokenRatio", mapG).floatValue();
                A4.g.t(fFloatValue > 0.0f, "maxToken should be greater than zero");
                A4.g.t(fFloatValue2 > 0.0f, "tokenRatio should be greater than zero");
                q13 = new Q1(fFloatValue, fFloatValue2);
            }
            q12 = q13;
        } else {
            q12 = null;
        }
        HashMap map2 = new HashMap();
        HashMap map3 = new HashMap();
        Map mapG2 = map == null ? null : AbstractC2557x0.g("healthCheckConfig", map);
        List<Map> listC = AbstractC2557x0.c("methodConfig", map);
        if (listC == null) {
            listC = null;
        } else {
            AbstractC2557x0.a(listC);
        }
        if (listC == null) {
            return new Y0(null, map2, map3, q12, obj, mapG2);
        }
        W0 w02 = null;
        for (Map map4 : listC) {
            W0 w03 = new W0(map4, z6, i6, i7);
            List<Map> listC2 = AbstractC2557x0.c(DiagnosticsEntry.NAME_KEY, map4);
            if (listC2 == null) {
                listC2 = null;
            } else {
                AbstractC2557x0.a(listC2);
            }
            if (listC2 != null && !listC2.isEmpty()) {
                for (Map map5 : listC2) {
                    String strH = AbstractC2557x0.h("service", map5);
                    String strH2 = AbstractC2557x0.h("method", map5);
                    if (e4.C.e0(strH)) {
                        A4.g.j(strH2, "missing service name for method %s", e4.C.e0(strH2));
                        A4.g.j(map, "Duplicate default method config in service config %s", w02 == null);
                        w02 = w03;
                    } else if (e4.C.e0(strH2)) {
                        A4.g.j(strH, "Duplicate service %s", !map3.containsKey(strH));
                        map3.put(strH, w03);
                    } else {
                        String strA = k4.i0.a(strH, strH2);
                        A4.g.j(strA, "Duplicate method name %s", !map2.containsKey(strA));
                        map2.put(strA, w03);
                    }
                }
            }
        }
        return new Y0(w02, map2, map3, q12, obj, mapG2);
    }

    public final X0 b() {
        if (this.f20916c.isEmpty() && this.f20915b.isEmpty() && this.f20914a == null) {
            return null;
        }
        return new X0(this);
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj != null && Y0.class == obj.getClass()) {
            Y0 y02 = (Y0) obj;
            if (android.support.v4.media.session.b.n(this.f20914a, y02.f20914a) && android.support.v4.media.session.b.n(this.f20915b, y02.f20915b) && android.support.v4.media.session.b.n(this.f20916c, y02.f20916c) && android.support.v4.media.session.b.n(this.f20917d, y02.f20917d) && android.support.v4.media.session.b.n(this.f20918e, y02.f20918e)) {
                return true;
            }
        }
        return false;
    }

    public final int hashCode() {
        return Arrays.hashCode(new Object[]{this.f20914a, this.f20915b, this.f20916c, this.f20917d, this.f20918e});
    }

    public final String toString() {
        E3.j jVarI0 = AbstractC0872a.i0(this);
        jVarI0.a(this.f20914a, "defaultMethodConfig");
        jVarI0.a(this.f20915b, "serviceMethodMap");
        jVarI0.a(this.f20916c, "serviceMap");
        jVarI0.a(this.f20917d, "retryThrottling");
        jVarI0.a(this.f20918e, "loadBalancingConfig");
        return jVarI0.toString();
    }
}
