package o;

import androidx.recyclerview.widget.RecyclerView;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.Api;
import java.nio.charset.Charset;
import java.util.Arrays;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.ui, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C2642ui {
    public final /* synthetic */ int a;
    public int b;
    public int c;
    public int d;
    public Object e;

    public /* synthetic */ C2642ui(int i) {
        this.a = i;
    }

    public void A(InterfaceC2323rI interfaceC2323rI) throws EI {
        int iZ;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        int i = this.b & 7;
        if (i == 0) {
            do {
                ((C2625uZ) interfaceC2323rI).add(Long.valueOf(abstractC2071oh.B()));
                if (abstractC2071oh.c()) {
                    return;
                } else {
                    iZ = abstractC2071oh.z();
                }
            } while (iZ == this.b);
            this.d = iZ;
            return;
        }
        if (i != 2) {
            throw EI.b();
        }
        int iB = abstractC2071oh.b() + abstractC2071oh.A();
        do {
            ((C2625uZ) interfaceC2323rI).add(Long.valueOf(abstractC2071oh.B()));
        } while (abstractC2071oh.b() < iB);
        B(iB);
    }

    public void B(int i) throws EI {
        if (((AbstractC2071oh) this.e).b() != i) {
            throw EI.e();
        }
    }

    public void C(int i) throws DI {
        if ((this.b & 7) != i) {
            throw EI.b();
        }
    }

    public boolean D() {
        int i;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        if (abstractC2071oh.c() || (i = this.b) == this.c) {
            return false;
        }
        return abstractC2071oh.C(i);
    }

    public void a(int i, int i2) {
        if (i < 0) {
            throw new IllegalArgumentException("Layout positions must be non-negative");
        }
        if (i2 < 0) {
            throw new IllegalArgumentException("Pixel distance must be non-negative");
        }
        int i3 = this.d;
        int i4 = i3 * 2;
        int[] iArr = (int[]) this.e;
        if (iArr == null) {
            int[] iArr2 = new int[4];
            this.e = iArr2;
            Arrays.fill(iArr2, -1);
        } else if (i4 >= iArr.length) {
            int[] iArr3 = new int[i3 * 4];
            this.e = iArr3;
            System.arraycopy(iArr, 0, iArr3, 0, iArr.length);
        }
        int[] iArr4 = (int[]) this.e;
        iArr4[i4] = i;
        iArr4[i4 + 1] = i2;
        this.d++;
    }

    public C3066z50 b(int i) {
        return new C3066z50(AbstractC0249Jp.L((Ne0) this.e, i), i, 1L);
    }

    public void c(RecyclerView recyclerView, boolean z) {
        this.d = 0;
        int[] iArr = (int[]) this.e;
        if (iArr != null) {
            Arrays.fill(iArr, -1);
        }
        AbstractC1157f10 abstractC1157f10 = recyclerView.w;
        if (recyclerView.v == null || abstractC1157f10 == null || !abstractC1157f10.i) {
            return;
        }
        if (z) {
            if (!recyclerView.f19o.s()) {
                abstractC1157f10.i(recyclerView.v.a(), this);
            }
        } else if (!recyclerView.K()) {
            abstractC1157f10.h(this.b, this.c, recyclerView.n0, this);
        }
        int i = this.d;
        if (i > abstractC1157f10.j) {
            abstractC1157f10.j = i;
            abstractC1157f10.k = z;
            recyclerView.m.k();
        }
    }

    public int d() {
        return this.d - this.c;
    }

    public int e() {
        int i = this.d;
        if (i != 0) {
            this.b = i;
            this.d = 0;
        } else {
            this.b = ((AbstractC2071oh) this.e).z();
        }
        int i2 = this.b;
        return (i2 == 0 || i2 == this.c) ? Api.BaseClientBuilder.API_PRIORITY_OTHER : i2 >>> 3;
    }

    public int f(int i) {
        return ((JU) this.e).i[this.c + i];
    }

    public Object g(int i) {
        return ((JU) this.e).k[this.d + i];
    }

    public void h(Object obj, I40 i40, C2481sx c2481sx) {
        int i = this.c;
        this.c = ((this.b >>> 3) << 3) | 4;
        try {
            i40.f(obj, this, c2481sx);
            if (this.b == this.c) {
            } else {
                throw new EI("Failed to parse the message.");
            }
        } finally {
            this.c = i;
        }
    }

    public void i(Object obj, I40 i40, C2481sx c2481sx) throws EI {
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        int iA = abstractC2071oh.A();
        if (abstractC2071oh.l >= 100) {
            throw new EI("Protocol message had too many levels of nesting.  May be malicious.  Use setRecursionLimit() to increase the recursion depth limit.");
        }
        int iJ = abstractC2071oh.j(iA);
        abstractC2071oh.l++;
        i40.f(obj, this, c2481sx);
        abstractC2071oh.a(0);
        abstractC2071oh.l--;
        abstractC2071oh.h(iJ);
    }

    public void j(InterfaceC2323rI interfaceC2323rI) throws EI {
        int iZ;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        int i = this.b & 7;
        if (i == 0) {
            do {
                ((C2625uZ) interfaceC2323rI).add(Boolean.valueOf(abstractC2071oh.k()));
                if (abstractC2071oh.c()) {
                    return;
                } else {
                    iZ = abstractC2071oh.z();
                }
            } while (iZ == this.b);
            this.d = iZ;
            return;
        }
        if (i != 2) {
            throw EI.b();
        }
        int iB = abstractC2071oh.b() + abstractC2071oh.A();
        do {
            ((C2625uZ) interfaceC2323rI).add(Boolean.valueOf(abstractC2071oh.k()));
        } while (abstractC2071oh.b() < iB);
        B(iB);
    }

    public AbstractC0161Gf k() throws DI {
        C(2);
        return ((AbstractC2071oh) this.e).l();
    }

    public void l(InterfaceC2323rI interfaceC2323rI) throws DI {
        int iZ;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        if ((this.b & 7) != 2) {
            throw EI.b();
        }
        do {
            ((C2625uZ) interfaceC2323rI).add(k());
            if (abstractC2071oh.c()) {
                return;
            } else {
                iZ = abstractC2071oh.z();
            }
        } while (iZ == this.b);
        this.d = iZ;
    }

    public void m(InterfaceC2323rI interfaceC2323rI) throws EI {
        int iZ;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        int i = this.b & 7;
        if (i == 1) {
            do {
                ((C2625uZ) interfaceC2323rI).add(Double.valueOf(abstractC2071oh.m()));
                if (abstractC2071oh.c()) {
                    return;
                } else {
                    iZ = abstractC2071oh.z();
                }
            } while (iZ == this.b);
            this.d = iZ;
            return;
        }
        if (i != 2) {
            throw EI.b();
        }
        int iA = abstractC2071oh.A();
        if ((iA & 7) != 0) {
            throw new EI("Failed to parse the message.");
        }
        int iB = abstractC2071oh.b() + iA;
        do {
            ((C2625uZ) interfaceC2323rI).add(Double.valueOf(abstractC2071oh.m()));
        } while (abstractC2071oh.b() < iB);
    }

    public void n(InterfaceC2323rI interfaceC2323rI) throws EI {
        int iZ;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        int i = this.b & 7;
        if (i == 0) {
            do {
                ((C2625uZ) interfaceC2323rI).add(Integer.valueOf(abstractC2071oh.n()));
                if (abstractC2071oh.c()) {
                    return;
                } else {
                    iZ = abstractC2071oh.z();
                }
            } while (iZ == this.b);
            this.d = iZ;
            return;
        }
        if (i != 2) {
            throw EI.b();
        }
        int iB = abstractC2071oh.b() + abstractC2071oh.A();
        do {
            ((C2625uZ) interfaceC2323rI).add(Integer.valueOf(abstractC2071oh.n()));
        } while (abstractC2071oh.b() < iB);
        B(iB);
    }

    public Object o(EnumC1129em0 enumC1129em0, Class cls, C2481sx c2481sx) throws EI {
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        switch (enumC1129em0.ordinal()) {
            case 0:
                C(1);
                return Double.valueOf(abstractC2071oh.m());
            case 1:
                C(5);
                return Float.valueOf(abstractC2071oh.q());
            case 2:
                C(0);
                return Long.valueOf(abstractC2071oh.s());
            case 3:
                C(0);
                return Long.valueOf(abstractC2071oh.B());
            case 4:
                C(0);
                return Integer.valueOf(abstractC2071oh.r());
            case 5:
                C(1);
                return Long.valueOf(abstractC2071oh.p());
            case 6:
                C(5);
                return Integer.valueOf(abstractC2071oh.o());
            case 7:
                C(0);
                return Boolean.valueOf(abstractC2071oh.k());
            case 8:
                C(2);
                return abstractC2071oh.y();
            case ConnectionResult.SERVICE_INVALID /* 9 */:
            default:
                throw new IllegalArgumentException("unsupported field type.");
            case 10:
                C(2);
                I40 i40A = C2530tZ.c.a(cls);
                DD ddH = i40A.h();
                i(ddH, i40A, c2481sx);
                i40A.c(ddH);
                return ddH;
            case ConnectionResult.LICENSE_CHECK_FAILED /* 11 */:
                return k();
            case 12:
                C(0);
                return Integer.valueOf(abstractC2071oh.A());
            case 13:
                C(0);
                return Integer.valueOf(abstractC2071oh.n());
            case 14:
                C(5);
                return Integer.valueOf(abstractC2071oh.t());
            case 15:
                C(1);
                return Long.valueOf(abstractC2071oh.u());
            case 16:
                C(0);
                return Integer.valueOf(abstractC2071oh.v());
            case 17:
                C(0);
                return Long.valueOf(abstractC2071oh.w());
        }
    }

    public void p(InterfaceC2323rI interfaceC2323rI) throws EI {
        int iZ;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        int i = this.b & 7;
        if (i == 2) {
            int iA = abstractC2071oh.A();
            if ((iA & 3) != 0) {
                throw new EI("Failed to parse the message.");
            }
            int iB = abstractC2071oh.b() + iA;
            do {
                ((C2625uZ) interfaceC2323rI).add(Integer.valueOf(abstractC2071oh.o()));
            } while (abstractC2071oh.b() < iB);
            return;
        }
        if (i != 5) {
            throw EI.b();
        }
        do {
            ((C2625uZ) interfaceC2323rI).add(Integer.valueOf(abstractC2071oh.o()));
            if (abstractC2071oh.c()) {
                return;
            } else {
                iZ = abstractC2071oh.z();
            }
        } while (iZ == this.b);
        this.d = iZ;
    }

    public void q(InterfaceC2323rI interfaceC2323rI) throws EI {
        int iZ;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        int i = this.b & 7;
        if (i == 1) {
            do {
                ((C2625uZ) interfaceC2323rI).add(Long.valueOf(abstractC2071oh.p()));
                if (abstractC2071oh.c()) {
                    return;
                } else {
                    iZ = abstractC2071oh.z();
                }
            } while (iZ == this.b);
            this.d = iZ;
            return;
        }
        if (i != 2) {
            throw EI.b();
        }
        int iA = abstractC2071oh.A();
        if ((iA & 7) != 0) {
            throw new EI("Failed to parse the message.");
        }
        int iB = abstractC2071oh.b() + iA;
        do {
            ((C2625uZ) interfaceC2323rI).add(Long.valueOf(abstractC2071oh.p()));
        } while (abstractC2071oh.b() < iB);
    }

    public void r(InterfaceC2323rI interfaceC2323rI) throws EI {
        int iZ;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        int i = this.b & 7;
        if (i == 2) {
            int iA = abstractC2071oh.A();
            if ((iA & 3) != 0) {
                throw new EI("Failed to parse the message.");
            }
            int iB = abstractC2071oh.b() + iA;
            do {
                ((C2625uZ) interfaceC2323rI).add(Float.valueOf(abstractC2071oh.q()));
            } while (abstractC2071oh.b() < iB);
            return;
        }
        if (i != 5) {
            throw EI.b();
        }
        do {
            ((C2625uZ) interfaceC2323rI).add(Float.valueOf(abstractC2071oh.q()));
            if (abstractC2071oh.c()) {
                return;
            } else {
                iZ = abstractC2071oh.z();
            }
        } while (iZ == this.b);
        this.d = iZ;
    }

    public void s(InterfaceC2323rI interfaceC2323rI) throws EI {
        int iZ;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        int i = this.b & 7;
        if (i == 0) {
            do {
                ((C2625uZ) interfaceC2323rI).add(Integer.valueOf(abstractC2071oh.r()));
                if (abstractC2071oh.c()) {
                    return;
                } else {
                    iZ = abstractC2071oh.z();
                }
            } while (iZ == this.b);
            this.d = iZ;
            return;
        }
        if (i != 2) {
            throw EI.b();
        }
        int iB = abstractC2071oh.b() + abstractC2071oh.A();
        do {
            ((C2625uZ) interfaceC2323rI).add(Integer.valueOf(abstractC2071oh.r()));
        } while (abstractC2071oh.b() < iB);
        B(iB);
    }

    public void t(InterfaceC2323rI interfaceC2323rI) throws EI {
        int iZ;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        int i = this.b & 7;
        if (i == 0) {
            do {
                ((C2625uZ) interfaceC2323rI).add(Long.valueOf(abstractC2071oh.s()));
                if (abstractC2071oh.c()) {
                    return;
                } else {
                    iZ = abstractC2071oh.z();
                }
            } while (iZ == this.b);
            this.d = iZ;
            return;
        }
        if (i != 2) {
            throw EI.b();
        }
        int iB = abstractC2071oh.b() + abstractC2071oh.A();
        do {
            ((C2625uZ) interfaceC2323rI).add(Long.valueOf(abstractC2071oh.s()));
        } while (abstractC2071oh.b() < iB);
        B(iB);
    }

    public String toString() {
        switch (this.a) {
            case 1:
                return "";
            case 4:
                StringBuilder sb = new StringBuilder("SelectionInfo(id=1, range=(");
                int i = this.b;
                sb.append(i);
                sb.append('-');
                Ne0 ne0 = (Ne0) this.e;
                sb.append(AbstractC0126Ew.t(AbstractC0249Jp.L(ne0, i)));
                sb.append(',');
                int i2 = this.c;
                sb.append(i2);
                sb.append('-');
                sb.append(AbstractC0126Ew.t(AbstractC0249Jp.L(ne0, i2)));
                sb.append("), prevOffset=");
                return AbstractC2462sn.m(sb, this.d, ')');
            default:
                return super.toString();
        }
    }

    public void u(InterfaceC2323rI interfaceC2323rI) throws EI {
        int iZ;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        int i = this.b & 7;
        if (i == 2) {
            int iA = abstractC2071oh.A();
            if ((iA & 3) != 0) {
                throw new EI("Failed to parse the message.");
            }
            int iB = abstractC2071oh.b() + iA;
            do {
                ((C2625uZ) interfaceC2323rI).add(Integer.valueOf(abstractC2071oh.t()));
            } while (abstractC2071oh.b() < iB);
            return;
        }
        if (i != 5) {
            throw EI.b();
        }
        do {
            ((C2625uZ) interfaceC2323rI).add(Integer.valueOf(abstractC2071oh.t()));
            if (abstractC2071oh.c()) {
                return;
            } else {
                iZ = abstractC2071oh.z();
            }
        } while (iZ == this.b);
        this.d = iZ;
    }

    public void v(InterfaceC2323rI interfaceC2323rI) throws EI {
        int iZ;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        int i = this.b & 7;
        if (i == 1) {
            do {
                ((C2625uZ) interfaceC2323rI).add(Long.valueOf(abstractC2071oh.u()));
                if (abstractC2071oh.c()) {
                    return;
                } else {
                    iZ = abstractC2071oh.z();
                }
            } while (iZ == this.b);
            this.d = iZ;
            return;
        }
        if (i != 2) {
            throw EI.b();
        }
        int iA = abstractC2071oh.A();
        if ((iA & 7) != 0) {
            throw new EI("Failed to parse the message.");
        }
        int iB = abstractC2071oh.b() + iA;
        do {
            ((C2625uZ) interfaceC2323rI).add(Long.valueOf(abstractC2071oh.u()));
        } while (abstractC2071oh.b() < iB);
    }

    public void w(InterfaceC2323rI interfaceC2323rI) throws EI {
        int iZ;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        int i = this.b & 7;
        if (i == 0) {
            do {
                ((C2625uZ) interfaceC2323rI).add(Integer.valueOf(abstractC2071oh.v()));
                if (abstractC2071oh.c()) {
                    return;
                } else {
                    iZ = abstractC2071oh.z();
                }
            } while (iZ == this.b);
            this.d = iZ;
            return;
        }
        if (i != 2) {
            throw EI.b();
        }
        int iB = abstractC2071oh.b() + abstractC2071oh.A();
        do {
            ((C2625uZ) interfaceC2323rI).add(Integer.valueOf(abstractC2071oh.v()));
        } while (abstractC2071oh.b() < iB);
        B(iB);
    }

    public void x(InterfaceC2323rI interfaceC2323rI) throws EI {
        int iZ;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        int i = this.b & 7;
        if (i == 0) {
            do {
                ((C2625uZ) interfaceC2323rI).add(Long.valueOf(abstractC2071oh.w()));
                if (abstractC2071oh.c()) {
                    return;
                } else {
                    iZ = abstractC2071oh.z();
                }
            } while (iZ == this.b);
            this.d = iZ;
            return;
        }
        if (i != 2) {
            throw EI.b();
        }
        int iB = abstractC2071oh.b() + abstractC2071oh.A();
        do {
            ((C2625uZ) interfaceC2323rI).add(Long.valueOf(abstractC2071oh.w()));
        } while (abstractC2071oh.b() < iB);
        B(iB);
    }

    public void y(InterfaceC2323rI interfaceC2323rI, boolean z) throws DI {
        String strX;
        int iZ;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        if ((this.b & 7) != 2) {
            throw EI.b();
        }
        do {
            if (z) {
                C(2);
                strX = abstractC2071oh.y();
            } else {
                C(2);
                strX = abstractC2071oh.x();
            }
            ((C2625uZ) interfaceC2323rI).add(strX);
            if (abstractC2071oh.c()) {
                return;
            } else {
                iZ = abstractC2071oh.z();
            }
        } while (iZ == this.b);
        this.d = iZ;
    }

    public void z(InterfaceC2323rI interfaceC2323rI) throws EI {
        int iZ;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) this.e;
        int i = this.b & 7;
        if (i == 0) {
            do {
                ((C2625uZ) interfaceC2323rI).add(Integer.valueOf(abstractC2071oh.A()));
                if (abstractC2071oh.c()) {
                    return;
                } else {
                    iZ = abstractC2071oh.z();
                }
            } while (iZ == this.b);
            this.d = iZ;
            return;
        }
        if (i != 2) {
            throw EI.b();
        }
        int iB = abstractC2071oh.b() + abstractC2071oh.A();
        do {
            ((C2625uZ) interfaceC2323rI).add(Integer.valueOf(abstractC2071oh.A()));
        } while (abstractC2071oh.b() < iB);
        B(iB);
    }

    public C2642ui(AbstractC2071oh abstractC2071oh) {
        this.a = 0;
        this.d = 0;
        Charset charset = AbstractC2418sI.a;
        this.e = abstractC2071oh;
        abstractC2071oh.m = this;
    }

    public C2642ui(JU ju) {
        this.a = 3;
        this.e = ju;
    }

    public C2642ui(int i, int i2, int i3, Ne0 ne0) {
        this.a = 4;
        this.b = i;
        this.c = i2;
        this.d = i3;
        this.e = ne0;
    }
}
