package L0;

import d3.R0;
import java.io.IOException;

/* JADX INFO: loaded from: classes.dex */
public final class Q implements c0 {

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public final int f3683q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final /* synthetic */ T f3684r;

    public Q(T t6, int i) {
        this.f3684r = t6;
        this.f3683q = i;
    }

    @Override // L0.c0
    public final boolean f() {
        T t6 = this.f3684r;
        return !t6.G() && t6.f3696J[this.f3683q].u(t6.f3715d0);
    }

    @Override // L0.c0
    public final int i(R0 r02, A0.h hVar, int i) {
        T t6 = this.f3684r;
        if (t6.G()) {
            return -3;
        }
        int i5 = this.f3683q;
        t6.B(i5);
        int iY = t6.f3696J[i5].y(r02, hVar, i, t6.f3715d0);
        if (iY == -3) {
            t6.C(i5);
        }
        return iY;
    }

    @Override // L0.c0
    public final void l() throws IOException {
        T t6 = this.f3684r;
        b0 b0Var = t6.f3696J[this.f3683q];
        K4.c cVar = b0Var.f3776h;
        if (cVar != null && cVar.A() == 1) {
            E0.c cVarX = b0Var.f3776h.x();
            cVarX.getClass();
            throw cVarX;
        }
        int iO = t6.f3720t.o(t6.f3706T);
        P0.m mVar = t6.f3690B;
        IOException iOException = mVar.f5306c;
        if (iOException != null) {
            throw iOException;
        }
        P0.i iVar = mVar.f5305b;
        if (iVar != null) {
            if (iO == Integer.MIN_VALUE) {
                iO = iVar.f5291q;
            }
            IOException iOException2 = iVar.f5295u;
            if (iOException2 != null && iVar.f5296v > iO) {
                throw iOException2;
            }
        }
    }

    @Override // L0.c0
    public final int m(long j8) {
        T t6 = this.f3684r;
        if (t6.G()) {
            return 0;
        }
        int i = this.f3683q;
        t6.B(i);
        b0 b0Var = t6.f3696J[i];
        int iS = b0Var.s(j8, t6.f3715d0);
        b0Var.D(iS);
        if (iS == 0) {
            t6.C(i);
        }
        return iS;
    }
}
