package lh;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import lh.i;

/* loaded from: classes4.dex */
public class t {

    /* renamed from: a, reason: collision with root package name */
    private final Class f28244a;

    /* renamed from: b, reason: collision with root package name */
    private final s3.f f28245b;

    /* renamed from: c, reason: collision with root package name */
    private final List f28246c;

    /* renamed from: d, reason: collision with root package name */
    private final String f28247d;

    public t(Class cls, Class cls2, Class cls3, List list, s3.f fVar) {
        this.f28244a = cls;
        this.f28245b = fVar;
        this.f28246c = (List) ei.k.c(list);
        this.f28247d = "Failed LoadPath{" + cls.getSimpleName() + "->" + cls2.getSimpleName() + "->" + cls3.getSimpleName() + "}";
    }

    private v b(com.bumptech.glide.load.data.e eVar, jh.h hVar, int i10, int i11, i.a aVar, List list) {
        int size = this.f28246c.size();
        v vVar = null;
        for (int i12 = 0; i12 < size; i12++) {
            try {
                vVar = ((i) this.f28246c.get(i12)).a(eVar, i10, i11, hVar, aVar);
            } catch (q e10) {
                list.add(e10);
            }
            if (vVar != null) {
                break;
            }
        }
        if (vVar != null) {
            return vVar;
        }
        throw new q(this.f28247d, new ArrayList(list));
    }

    public v a(com.bumptech.glide.load.data.e eVar, jh.h hVar, int i10, int i11, i.a aVar) {
        List list = (List) ei.k.d(this.f28245b.b());
        try {
            return b(eVar, hVar, i10, i11, aVar, list);
        } finally {
            this.f28245b.a(list);
        }
    }

    public String toString() {
        return "LoadPath{decodePaths=" + Arrays.toString(this.f28246c.toArray()) + '}';
    }
}
