package R0;

import java.util.Arrays;

/* JADX INFO: loaded from: classes.dex */
public final class d {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public long f5876a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public long f5877b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public long f5878c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public long f5879d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public long f5880e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public long f5881f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final boolean[] f5882g = new boolean[15];

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

    public final boolean a() {
        return this.f5879d > 15 && this.f5883h == 0;
    }

    public final void b(long j8) {
        long j9 = this.f5879d;
        if (j9 == 0) {
            this.f5876a = j8;
        } else if (j9 == 1) {
            long j10 = j8 - this.f5876a;
            this.f5877b = j10;
            this.f5881f = j10;
            this.f5880e = 1L;
        } else {
            long j11 = j8 - this.f5878c;
            int i = (int) (j9 % 15);
            long jAbs = Math.abs(j11 - this.f5877b);
            boolean[] zArr = this.f5882g;
            if (jAbs <= 1000000) {
                this.f5880e++;
                this.f5881f += j11;
                if (zArr[i]) {
                    zArr[i] = false;
                    this.f5883h--;
                }
            } else if (!zArr[i]) {
                zArr[i] = true;
                this.f5883h++;
            }
        }
        this.f5879d++;
        this.f5878c = j8;
    }

    public final void c() {
        this.f5879d = 0L;
        this.f5880e = 0L;
        this.f5881f = 0L;
        this.f5883h = 0;
        Arrays.fill(this.f5882g, false);
    }
}
