package c.i.a.c.i2; import androidx.annotation.Nullable; import com.airbnb.lottie.parser.AnimatableValueParser; import java.util.Arrays; /* compiled from: TimedValueQueue */ public final class d0 { public long[] a = new long[10]; public V[] b = ((V[]) new Object[10]); /* renamed from: c reason: collision with root package name */ public int f901c; public int d; public synchronized void a(long j, V v) { int i = this.d; if (i > 0) { if (j <= this.a[((this.f901c + i) - 1) % this.b.length]) { b(); } } c(); int i2 = this.f901c; int i3 = this.d; V[] vArr = this.b; int length = (i2 + i3) % vArr.length; this.a[length] = j; vArr[length] = v; this.d = i3 + 1; } public synchronized void b() { this.f901c = 0; this.d = 0; Arrays.fill(this.b, (Object) null); } public final void c() { int length = this.b.length; if (this.d >= length) { int i = length * 2; long[] jArr = new long[i]; V[] vArr = (V[]) new Object[i]; int i2 = this.f901c; int i3 = length - i2; System.arraycopy(this.a, i2, jArr, 0, i3); System.arraycopy(this.b, this.f901c, vArr, 0, i3); int i4 = this.f901c; if (i4 > 0) { System.arraycopy(this.a, 0, jArr, i3, i4); System.arraycopy(this.b, 0, vArr, i3, this.f901c); } this.a = jArr; this.b = vArr; this.f901c = 0; } } @Nullable public final V d(long j, boolean z2) { V v = null; long j2 = Long.MAX_VALUE; while (this.d > 0) { long j3 = j - this.a[this.f901c]; if (j3 < 0 && (z2 || (-j3) >= j2)) { break; } v = f(); j2 = j3; } return v; } @Nullable public synchronized V e(long j) { return d(j, true); } @Nullable public final V f() { AnimatableValueParser.D(this.d > 0); V[] vArr = this.b; int i = this.f901c; V v = vArr[i]; vArr[i] = null; this.f901c = (i + 1) % vArr.length; this.d--; return v; } }