package ඓ.ῲ.K.ᕣ.㳳;

import com.bumptech.glide.Priority;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import ඓ.ῲ.K.ᕣ.AbstractC1029;
import ඓ.ῲ.K.ᕣ.C1121;
import ඓ.ῲ.K.ᕣ.㳳.AbstractC1033;
import ඓ.ῲ.K.ᕣ.㿎.AbstractC1146;
import ඓ.K.K.K.C1293;
import ῲ.ᨨ.㳳.C1841;
import ῲ.ᨨ.㿎.AbstractC1871;

/* renamed from: ඓ.ῲ.K.ᕣ.㳳.ᓣ  reason: contains not printable characters */
/* compiled from: MultiModelLoader */
public class C1072<Model, Data> implements AbstractC1033<Model, Data> {

    /* renamed from: ῲ  reason: contains not printable characters */
    public final AbstractC1871<List<Throwable>> f4525;

    /* renamed from: K  reason: contains not printable characters */
    public final List<AbstractC1033<Model, Data>> f4526;

    public C1072(List<AbstractC1033<Model, Data>> list, AbstractC1871<List<Throwable>> r2) {
        this.f4526 = list;
        this.f4525 = r2;
    }

    public String toString() {
        StringBuilder r0 = C1293.m3416("MultiModelLoader{modelLoaders=");
        r0.append(Arrays.toString(this.f4526.toArray()));
        r0.append('}');
        return r0.toString();
    }

    @Override // ඓ.ῲ.K.ᕣ.㳳.AbstractC1033
    /* renamed from: K  reason: contains not printable characters */
    public AbstractC1033.C1034<Data> m2909(Model model, int i, int i2, C1121 r11) {
        AbstractC1033.C1034<Data> r5;
        int size = this.f4526.size();
        ArrayList arrayList = new ArrayList(size);
        AbstractC1029 r4 = null;
        for (int i3 = 0; i3 < size; i3++) {
            AbstractC1033<Model, Data> r52 = this.f4526.get(i3);
            if (r52.m2850(model) && (r5 = r52.m2849(model, i, i2, r11)) != null) {
                r4 = r5.f4476;
                arrayList.add(r5.f4474);
            }
        }
        if (arrayList.isEmpty() || r4 == null) {
            return null;
        }
        return new AbstractC1033.C1034<>(r4, new C1073(arrayList, this.f4525));
    }

    /* renamed from: ඓ.ῲ.K.ᕣ.㳳.ᓣ$K  reason: contains not printable characters */
    /* compiled from: MultiModelLoader */
    public static class C1073<Data> implements AbstractC1146<Data>, AbstractC1146.AbstractC1147<Data> {

        /* renamed from: ʬ  reason: contains not printable characters */
        public final AbstractC1871<List<Throwable>> f4527;

        /* renamed from: ඓ  reason: contains not printable characters */
        public Priority f4528;

        /* renamed from: ῲ  reason: contains not printable characters */
        public final List<AbstractC1146<Data>> f4529;

        /* renamed from: ⁱ  reason: contains not printable characters */
        public List<Throwable> f4530;

        /* renamed from: 㴹  reason: contains not printable characters */
        public AbstractC1146.AbstractC1147<? super Data> f4531;

        /* renamed from: 㸾  reason: contains not printable characters */
        public int f4532;

        /* renamed from: 㿎  reason: contains not printable characters */
        public boolean f4533;

        public C1073(List<AbstractC1146<Data>> list, AbstractC1871<List<Throwable>> r2) {
            this.f4527 = r2;
            if (!list.isEmpty()) {
                this.f4529 = list;
                this.f4532 = 0;
                return;
            }
            throw new IllegalArgumentException("Must not be empty.");
        }

        @Override // ඓ.ῲ.K.ᕣ.㿎.AbstractC1146
        public void cancel() {
            this.f4533 = true;
            for (AbstractC1146<Data> r1 : this.f4529) {
                r1.cancel();
            }
        }

        @Override // ඓ.ῲ.K.ᕣ.㿎.AbstractC1146
        /* renamed from: ʬ  reason: contains not printable characters */
        public DataSource m2911() {
            return this.f4529.get(0).m3064();
        }

        @Override // ඓ.ῲ.K.ᕣ.㿎.AbstractC1146
        /* renamed from: ῲ  reason: contains not printable characters */
        public void m2912() {
            List<Throwable> list = this.f4530;
            if (list != null) {
                this.f4527.m4836(list);
            }
            this.f4530 = null;
            for (AbstractC1146<Data> r1 : this.f4529) {
                r1.m3065();
            }
        }

        @Override // ඓ.ῲ.K.ᕣ.㿎.AbstractC1146
        /* renamed from: K  reason: contains not printable characters */
        public void m2914(Priority priority, AbstractC1146.AbstractC1147<? super Data> k) {
            this.f4528 = priority;
            this.f4531 = k;
            this.f4530 = this.f4527.m4835();
            this.f4529.get(this.f4532).m3067(priority, this);
            if (this.f4533) {
                cancel();
            }
        }

        /* renamed from: 㸾  reason: contains not printable characters */
        public final void m2917() {
            if (!this.f4533) {
                if (this.f4532 < this.f4529.size() - 1) {
                    this.f4532++;
                    m2914(this.f4528, this.f4531);
                    return;
                }
                C1841.m4783(this.f4530, "Argument must not be null");
                this.f4531.m3068((Exception) new GlideException("Fetch failed", new ArrayList(this.f4530)));
            }
        }

        @Override // ඓ.ῲ.K.ᕣ.㿎.AbstractC1146
        /* renamed from: K  reason: contains not printable characters */
        public Class<Data> m2913() {
            return this.f4529.get(0).m3066();
        }

        @Override // ඓ.ῲ.K.ᕣ.㿎.AbstractC1146.AbstractC1147
        /* renamed from: K  reason: contains not printable characters */
        public void m2916(Data data) {
            if (data != null) {
                this.f4531.m3069((Object) data);
            } else {
                m2917();
            }
        }

        @Override // ඓ.ῲ.K.ᕣ.㿎.AbstractC1146.AbstractC1147
        /* renamed from: K  reason: contains not printable characters */
        public void m2915(Exception exc) {
            List<Throwable> list = this.f4530;
            C1841.m4783(list, "Argument must not be null");
            list.add(exc);
            m2917();
        }
    }

    @Override // ඓ.ῲ.K.ᕣ.㳳.AbstractC1033
    /* renamed from: K  reason: contains not printable characters */
    public boolean m2910(Model model) {
        for (AbstractC1033<Model, Data> r1 : this.f4526) {
            if (r1.m2850(model)) {
                return true;
            }
        }
        return false;
    }
}
