package okhttp3.internal.connection;

import java.net.Proxy;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import kotlin.jvm.internal.o;
import okhttp3.Address;
import okhttp3.Call;
import okhttp3.EventListener;
import okhttp3.HttpUrl;
import okhttp3.internal.Util;
import x4.y;

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

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

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

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

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

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

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

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public int f22372f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public Object f22373g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final ArrayList f22374h;

    public static final class Companion {
        public /* synthetic */ Companion(int i6) {
            this();
        }

        private Companion() {
        }
    }

    public static final class Selection {

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

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public int f22376b;

        public Selection(ArrayList arrayList) {
            this.f22375a = arrayList;
        }

        public final boolean a() {
            return this.f22376b < this.f22375a.size();
        }
    }

    public RouteSelector(Address address, RouteDatabase routeDatabase, Call call, EventListener eventListener) {
        List listK;
        o.h(routeDatabase, "routeDatabase");
        o.h(call, "call");
        o.h(eventListener, "eventListener");
        this.f22367a = address;
        this.f22368b = routeDatabase;
        this.f22369c = call;
        this.f22370d = eventListener;
        y yVar = y.f26065a;
        this.f22371e = yVar;
        this.f22373g = yVar;
        this.f22374h = new ArrayList();
        HttpUrl url = address.f21896h;
        o.h(url, "url");
        URI uriG = url.g();
        if (uriG.getHost() == null) {
            listK = Util.k(Proxy.NO_PROXY);
        } else {
            List<Proxy> listSelect = address.f21895g.select(uriG);
            listK = (listSelect == null || listSelect.isEmpty()) ? Util.k(Proxy.NO_PROXY) : Util.y(listSelect);
        }
        this.f22371e = listK;
        this.f22372f = 0;
    }

    public final boolean a() {
        return this.f22372f < this.f22371e.size() || !this.f22374h.isEmpty();
    }
}
