package j$.time.format;

import java.util.ArrayList;

/* JADX INFO: renamed from: j$.time.format.e, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes2.dex */
final class C2295e implements InterfaceC2296f {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private final InterfaceC2296f[] f19227a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final boolean f19228b;

    C2295e(ArrayList arrayList, boolean z6) {
        this((InterfaceC2296f[]) arrayList.toArray(new InterfaceC2296f[arrayList.size()]), z6);
    }

    C2295e(InterfaceC2296f[] interfaceC2296fArr, boolean z6) {
        this.f19227a = interfaceC2296fArr;
        this.f19228b = z6;
    }

    public final C2295e a() {
        return !this.f19228b ? this : new C2295e(this.f19227a, false);
    }

    /* JADX WARN: Code restructure failed: missing block: B:10:0x001a, code lost:
    
        r9.setLength(r0);
     */
    /* JADX WARN: Code restructure failed: missing block: B:13:0x0022, code lost:
    
        return true;
     */
    @Override // j$.time.format.InterfaceC2296f
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean p(z zVar, StringBuilder sb) {
        int length = sb.length();
        boolean z6 = this.f19228b;
        if (z6) {
            zVar.g();
        }
        try {
            InterfaceC2296f[] interfaceC2296fArr = this.f19227a;
            int length2 = interfaceC2296fArr.length;
            int i6 = 0;
            while (true) {
                if (i6 < length2) {
                    if (!interfaceC2296fArr[i6].p(zVar, sb)) {
                        break;
                    }
                    i6++;
                } else if (z6) {
                    zVar.a();
                }
            }
            return true;
        } finally {
            if (z6) {
                zVar.a();
            }
        }
    }

    @Override // j$.time.format.InterfaceC2296f
    public final int r(w wVar, CharSequence charSequence, int i6) {
        boolean z6 = this.f19228b;
        InterfaceC2296f[] interfaceC2296fArr = this.f19227a;
        if (z6) {
            wVar.r();
            int iR = i6;
            for (InterfaceC2296f interfaceC2296f : interfaceC2296fArr) {
                iR = interfaceC2296f.r(wVar, charSequence, iR);
                if (iR < 0) {
                    wVar.f(false);
                    return i6;
                }
            }
            wVar.f(true);
            return iR;
        }
        for (InterfaceC2296f interfaceC2296f2 : interfaceC2296fArr) {
            i6 = interfaceC2296f2.r(wVar, charSequence, i6);
            if (i6 < 0) {
                return i6;
            }
        }
        return i6;
    }

    public final String toString() {
        StringBuilder sb = new StringBuilder();
        InterfaceC2296f[] interfaceC2296fArr = this.f19227a;
        if (interfaceC2296fArr != null) {
            boolean z6 = this.f19228b;
            sb.append(z6 ? "[" : "(");
            for (InterfaceC2296f interfaceC2296f : interfaceC2296fArr) {
                sb.append(interfaceC2296f);
            }
            sb.append(z6 ? "]" : ")");
        }
        return sb.toString();
    }
}
