package o;

import java.io.IOException;
import java.util.ArrayList;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.ds, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C1044ds {
    public final String a;
    public final long[] b = new long[2];
    public final ArrayList c = new ArrayList(2);
    public final ArrayList d = new ArrayList(2);
    public boolean e;
    public boolean f;
    public C0949cs g;
    public int h;
    public final /* synthetic */ C1332gs i;

    public C1044ds(C1332gs c1332gs, String str) {
        this.i = c1332gs;
        this.a = str;
        StringBuilder sb = new StringBuilder(str);
        sb.append('.');
        int length = sb.length();
        for (int i = 0; i < 2; i++) {
            sb.append(i);
            this.c.add(this.i.l.d(sb.toString()));
            sb.append(".tmp");
            this.d.add(this.i.l.d(sb.toString()));
            sb.setLength(length);
        }
    }

    public final C1140es a() {
        if (!this.e || this.g != null || this.f) {
            return null;
        }
        ArrayList arrayList = this.c;
        int size = arrayList.size();
        int i = 0;
        while (true) {
            C1332gs c1332gs = this.i;
            if (i >= size) {
                this.h++;
                return new C1140es(c1332gs, this);
            }
            if (!c1332gs.A.e((SV) arrayList.get(i))) {
                try {
                    c1332gs.q(this);
                } catch (IOException unused) {
                }
                return null;
            }
            i++;
        }
    }
}
