package androidx.recyclerview.widget; import android.view.View; import android.view.ViewGroup; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; import java.util.List; /* loaded from: classes.dex */ class b { /* renamed from: a, reason: collision with root package name */ final InterfaceC0034b f2384a; /* renamed from: b, reason: collision with root package name */ final a f2385b = new a(); /* renamed from: c, reason: collision with root package name */ final List f2386c = new ArrayList(); static class a { /* renamed from: a, reason: collision with root package name */ long f2387a = 0; /* renamed from: b, reason: collision with root package name */ a f2388b; a() { } private void c() { if (this.f2388b == null) { this.f2388b = new a(); } } void a(int i10) { if (i10 < 64) { this.f2387a &= ~(1 << i10); return; } a aVar = this.f2388b; if (aVar != null) { aVar.a(i10 - 64); } } int b(int i10) { a aVar = this.f2388b; return aVar == null ? i10 >= 64 ? Long.bitCount(this.f2387a) : Long.bitCount(this.f2387a & ((1 << i10) - 1)) : i10 < 64 ? Long.bitCount(this.f2387a & ((1 << i10) - 1)) : aVar.b(i10 - 64) + Long.bitCount(this.f2387a); } boolean d(int i10) { if (i10 < 64) { return (this.f2387a & (1 << i10)) != 0; } c(); return this.f2388b.d(i10 - 64); } void e(int i10, boolean z10) { if (i10 >= 64) { c(); this.f2388b.e(i10 - 64, z10); return; } long j10 = this.f2387a; boolean z11 = (Long.MIN_VALUE & j10) != 0; long j11 = (1 << i10) - 1; this.f2387a = ((j10 & (~j11)) << 1) | (j10 & j11); if (z10) { h(i10); } else { a(i10); } if (z11 || this.f2388b != null) { c(); this.f2388b.e(0, z11); } } boolean f(int i10) { if (i10 >= 64) { c(); return this.f2388b.f(i10 - 64); } long j10 = 1 << i10; long j11 = this.f2387a; boolean z10 = (j11 & j10) != 0; long j12 = j11 & (~j10); this.f2387a = j12; long j13 = j10 - 1; this.f2387a = (j12 & j13) | Long.rotateRight((~j13) & j12, 1); a aVar = this.f2388b; if (aVar != null) { if (aVar.d(0)) { h(63); } this.f2388b.f(0); } return z10; } void g() { this.f2387a = 0L; a aVar = this.f2388b; if (aVar != null) { aVar.g(); } } void h(int i10) { if (i10 < 64) { this.f2387a |= 1 << i10; } else { c(); this.f2388b.h(i10 - 64); } } public String toString() { if (this.f2388b == null) { return Long.toBinaryString(this.f2387a); } return this.f2388b.toString() + "xx" + Long.toBinaryString(this.f2387a); } } /* renamed from: androidx.recyclerview.widget.b$b, reason: collision with other inner class name */ interface InterfaceC0034b { View a(int i10); void b(View view); int c(); void d(); int e(View view); RecyclerView.d0 f(View view); void g(int i10); void h(View view); void i(View view, int i10); void j(int i10); void k(View view, int i10, ViewGroup.LayoutParams layoutParams); } b(InterfaceC0034b interfaceC0034b) { this.f2384a = interfaceC0034b; } private int h(int i10) { if (i10 < 0) { return -1; } int c10 = this.f2384a.c(); int i11 = i10; while (i11 < c10) { int b10 = i10 - (i11 - this.f2385b.b(i11)); if (b10 == 0) { while (this.f2385b.d(i11)) { i11++; } return i11; } i11 += b10; } return -1; } private void l(View view) { this.f2386c.add(view); this.f2384a.b(view); } private boolean t(View view) { if (!this.f2386c.remove(view)) { return false; } this.f2384a.h(view); return true; } void a(View view, int i10, boolean z10) { int c10 = i10 < 0 ? this.f2384a.c() : h(i10); this.f2385b.e(c10, z10); if (z10) { l(view); } this.f2384a.i(view, c10); } void b(View view, boolean z10) { a(view, -1, z10); } void c(View view, int i10, ViewGroup.LayoutParams layoutParams, boolean z10) { int c10 = i10 < 0 ? this.f2384a.c() : h(i10); this.f2385b.e(c10, z10); if (z10) { l(view); } this.f2384a.k(view, c10, layoutParams); } void d(int i10) { int h10 = h(i10); this.f2385b.f(h10); this.f2384a.g(h10); } View e(int i10) { int size = this.f2386c.size(); for (int i11 = 0; i11 < size; i11++) { View view = (View) this.f2386c.get(i11); RecyclerView.d0 f10 = this.f2384a.f(view); if (f10.m() == i10 && !f10.t() && !f10.v()) { return view; } } return null; } View f(int i10) { return this.f2384a.a(h(i10)); } int g() { return this.f2384a.c() - this.f2386c.size(); } View i(int i10) { return this.f2384a.a(i10); } int j() { return this.f2384a.c(); } void k(View view) { int e10 = this.f2384a.e(view); if (e10 >= 0) { this.f2385b.h(e10); l(view); } else { throw new IllegalArgumentException("view is not a child, cannot hide " + view); } } int m(View view) { int e10 = this.f2384a.e(view); if (e10 == -1 || this.f2385b.d(e10)) { return -1; } return e10 - this.f2385b.b(e10); } boolean n(View view) { return this.f2386c.contains(view); } void o() { this.f2385b.g(); for (int size = this.f2386c.size() - 1; size >= 0; size--) { this.f2384a.h((View) this.f2386c.get(size)); this.f2386c.remove(size); } this.f2384a.d(); } void p(View view) { int e10 = this.f2384a.e(view); if (e10 < 0) { return; } if (this.f2385b.f(e10)) { t(view); } this.f2384a.j(e10); } void q(int i10) { int h10 = h(i10); View a10 = this.f2384a.a(h10); if (a10 == null) { return; } if (this.f2385b.f(h10)) { t(a10); } this.f2384a.j(h10); } boolean r(View view) { int e10 = this.f2384a.e(view); if (e10 == -1) { t(view); return true; } if (!this.f2385b.d(e10)) { return false; } this.f2385b.f(e10); t(view); this.f2384a.j(e10); return true; } void s(View view) { int e10 = this.f2384a.e(view); if (e10 < 0) { throw new IllegalArgumentException("view is not a child, cannot hide " + view); } if (this.f2385b.d(e10)) { this.f2385b.a(e10); t(view); } else { throw new RuntimeException("trying to unhide a view that was not hidden" + view); } } public String toString() { return this.f2385b.toString() + ", hidden list:" + this.f2386c.size(); } }