package kotlin.reflect.w.internal.y0.g;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import kotlin.reflect.w.internal.y0.i.a;
import kotlin.reflect.w.internal.y0.i.c;
import kotlin.reflect.w.internal.y0.i.d;
import kotlin.reflect.w.internal.y0.i.e;
import kotlin.reflect.w.internal.y0.i.f;
import kotlin.reflect.w.internal.y0.i.h;
import kotlin.reflect.w.internal.y0.i.j;
import kotlin.reflect.w.internal.y0.i.p;
import kotlin.reflect.w.internal.y0.i.q;
import kotlin.reflect.w.internal.y0.i.r;
import kotlin.reflect.w.internal.y0.i.v;

/* JADX INFO: loaded from: classes2.dex */
public final class t extends h implements q {

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static final t f8059f;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public static r<t> f8060m = new a();

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

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

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public List<q> f8063p;

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

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public byte f8065r;

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

    public static class a extends kotlin.reflect.w.internal.y0.i.b<t> {
        @Override // kotlin.reflect.w.internal.y0.i.r
        public Object a(d dVar, f fVar) {
            return new t(dVar, fVar, null);
        }
    }

    public static final class b extends h.b<t, b> implements q {

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

        /* JADX INFO: renamed from: n, reason: collision with root package name */
        public List<q> f8068n = Collections.emptyList();

        /* JADX INFO: renamed from: o, reason: collision with root package name */
        public int f8069o = -1;

        @Override // r.i0.w.b.y0.i.p.a
        public p a() {
            t tVarM = m();
            if (tVarM.i()) {
                return tVarM;
            }
            throw new v();
        }

        @Override // r.i0.w.b.y0.i.h.b
        public Object clone() {
            b bVar = new b();
            bVar.n(m());
            return bVar;
        }

        @Override // kotlin.reflect.w.internal.y0.i.a.AbstractC0155a, r.i0.w.b.y0.i.p.a
        public /* bridge */ /* synthetic */ p.a h(d dVar, f fVar) throws Throwable {
            o(dVar, fVar);
            return this;
        }

        @Override // kotlin.reflect.w.internal.y0.i.a.AbstractC0155a
        /* JADX INFO: renamed from: j */
        public /* bridge */ /* synthetic */ a.AbstractC0155a h(d dVar, f fVar) throws Throwable {
            o(dVar, fVar);
            return this;
        }

        @Override // r.i0.w.b.y0.i.h.b
        /* JADX INFO: renamed from: k */
        public h.b clone() {
            b bVar = new b();
            bVar.n(m());
            return bVar;
        }

        @Override // r.i0.w.b.y0.i.h.b
        public /* bridge */ /* synthetic */ h.b l(h hVar) {
            n((t) hVar);
            return this;
        }

        public t m() {
            t tVar = new t(this, null);
            int i2 = this.f8067m;
            if ((i2 & 1) == 1) {
                this.f8068n = Collections.unmodifiableList(this.f8068n);
                this.f8067m &= -2;
            }
            tVar.f8063p = this.f8068n;
            int i3 = (i2 & 2) != 2 ? 0 : 1;
            tVar.f8064q = this.f8069o;
            tVar.f8062o = i3;
            return tVar;
        }

        public b n(t tVar) {
            if (tVar == t.f8059f) {
                return this;
            }
            if (!tVar.f8063p.isEmpty()) {
                if (this.f8068n.isEmpty()) {
                    this.f8068n = tVar.f8063p;
                    this.f8067m &= -2;
                } else {
                    if ((this.f8067m & 1) != 1) {
                        this.f8068n = new ArrayList(this.f8068n);
                        this.f8067m |= 1;
                    }
                    this.f8068n.addAll(tVar.f8063p);
                }
            }
            if ((tVar.f8062o & 1) == 1) {
                int i2 = tVar.f8064q;
                this.f8067m |= 2;
                this.f8069o = i2;
            }
            this.f8259f = this.f8259f.b(tVar.f8061n);
            return this;
        }

        /* JADX WARN: Removed duplicated region for block: B:15:0x001b  */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
            To view partially-correct add '--show-bad-code' argument
        */
        public r.i0.w.b.y0.g.t.b o(kotlin.reflect.w.internal.y0.i.d r3, kotlin.reflect.w.internal.y0.i.f r4) throws java.lang.Throwable {
            /*
                r2 = this;
                r0 = 0
                r.i0.w.b.y0.i.r<r.i0.w.b.y0.g.t> r1 = kotlin.reflect.w.internal.y0.g.t.f8060m     // Catch: java.lang.Throwable -> Lf kotlin.reflect.w.internal.y0.i.j -> L11
                java.lang.Object r3 = r1.a(r3, r4)     // Catch: java.lang.Throwable -> Lf kotlin.reflect.w.internal.y0.i.j -> L11
                r.i0.w.b.y0.g.t r3 = (kotlin.reflect.w.internal.y0.g.t) r3     // Catch: java.lang.Throwable -> Lf kotlin.reflect.w.internal.y0.i.j -> L11
                if (r3 == 0) goto Le
                r2.n(r3)
            Le:
                return r2
            Lf:
                r3 = move-exception
                goto L19
            L11:
                r3 = move-exception
                r.i0.w.b.y0.i.p r4 = r3.f8275f     // Catch: java.lang.Throwable -> Lf
                r.i0.w.b.y0.g.t r4 = (kotlin.reflect.w.internal.y0.g.t) r4     // Catch: java.lang.Throwable -> Lf
                throw r3     // Catch: java.lang.Throwable -> L17
            L17:
                r3 = move-exception
                r0 = r4
            L19:
                if (r0 == 0) goto L1e
                r2.n(r0)
            L1e:
                throw r3
            */
            throw new UnsupportedOperationException("Method not decompiled: r.i0.w.b.y0.g.t.b.o(r.i0.w.b.y0.i.d, r.i0.w.b.y0.i.f):r.i0.w.b.y0.g.t$b");
        }
    }

    static {
        t tVar = new t();
        f8059f = tVar;
        tVar.f8063p = Collections.emptyList();
        tVar.f8064q = -1;
    }

    public t() {
        this.f8065r = (byte) -1;
        this.f8066s = -1;
        this.f8061n = c.f8234f;
    }

    public t(d dVar, f fVar, kotlin.reflect.w.internal.y0.g.a aVar) {
        this.f8065r = (byte) -1;
        this.f8066s = -1;
        this.f8063p = Collections.emptyList();
        this.f8064q = -1;
        c.b bVarN = c.n();
        e eVarK = e.k(bVarN, 1);
        boolean z2 = false;
        boolean z3 = false;
        while (!z2) {
            try {
                try {
                    try {
                        int iO = dVar.o();
                        if (iO != 0) {
                            if (iO == 10) {
                                if (!(z3 & true)) {
                                    this.f8063p = new ArrayList();
                                    z3 |= true;
                                }
                                this.f8063p.add((q) dVar.h(q.f7966n, fVar));
                            } else if (iO == 16) {
                                this.f8062o |= 1;
                                this.f8064q = dVar.l();
                            } else if (!dVar.r(iO, eVarK)) {
                            }
                        }
                        z2 = true;
                    } catch (j e2) {
                        e2.f8275f = this;
                        throw e2;
                    }
                } catch (IOException e3) {
                    j jVar = new j(e3.getMessage());
                    jVar.f8275f = this;
                    throw jVar;
                }
            } catch (Throwable th) {
                if (z3 & true) {
                    this.f8063p = Collections.unmodifiableList(this.f8063p);
                }
                try {
                    eVarK.j();
                } catch (IOException unused) {
                } catch (Throwable th2) {
                    this.f8061n = bVarN.d();
                    throw th2;
                }
                this.f8061n = bVarN.d();
                throw th;
            }
        }
        if (z3 & true) {
            this.f8063p = Collections.unmodifiableList(this.f8063p);
        }
        try {
            eVarK.j();
        } catch (IOException unused2) {
        } catch (Throwable th3) {
            this.f8061n = bVarN.d();
            throw th3;
        }
        this.f8061n = bVarN.d();
    }

    public static b k(t tVar) {
        b bVar = new b();
        bVar.n(tVar);
        return bVar;
    }

    @Override // kotlin.reflect.w.internal.y0.i.p
    public p.a c() {
        return k(this);
    }

    @Override // kotlin.reflect.w.internal.y0.i.p
    public void d(e eVar) throws IOException {
        f();
        for (int i2 = 0; i2 < this.f8063p.size(); i2++) {
            eVar.r(1, this.f8063p.get(i2));
        }
        if ((this.f8062o & 1) == 1) {
            eVar.p(2, this.f8064q);
        }
        eVar.u(this.f8061n);
    }

    @Override // kotlin.reflect.w.internal.y0.i.p
    public int f() {
        int i2 = this.f8066s;
        if (i2 != -1) {
            return i2;
        }
        int iC = 0;
        for (int i3 = 0; i3 < this.f8063p.size(); i3++) {
            iC += e.e(1, this.f8063p.get(i3));
        }
        if ((this.f8062o & 1) == 1) {
            iC += e.c(2, this.f8064q);
        }
        int size = this.f8061n.size() + iC;
        this.f8066s = size;
        return size;
    }

    @Override // kotlin.reflect.w.internal.y0.i.p
    public p.a g() {
        return new b();
    }

    @Override // kotlin.reflect.w.internal.y0.i.q
    public final boolean i() {
        byte b2 = this.f8065r;
        if (b2 == 1) {
            return true;
        }
        if (b2 == 0) {
            return false;
        }
        for (int i2 = 0; i2 < this.f8063p.size(); i2++) {
            if (!this.f8063p.get(i2).i()) {
                this.f8065r = (byte) 0;
                return false;
            }
        }
        this.f8065r = (byte) 1;
        return true;
    }

    public b l() {
        return k(this);
    }

    public t(h.b bVar, kotlin.reflect.w.internal.y0.g.a aVar) {
        super(bVar);
        this.f8065r = (byte) -1;
        this.f8066s = -1;
        this.f8061n = bVar.f8259f;
    }
}
