package p037.p107.p108;

import android.view.View;
import android.view.ViewGroup;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
import p037.p065.p078.C1920;
import p138.p139.p143.p144.C2803;

/* JADX INFO: renamed from: މ.ޏ.ށ.ބ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C2317 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final InterfaceC2319 f7341;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final C2318 f7342 = new C2318();

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final List<View> f7343 = new ArrayList();

    /* JADX INFO: renamed from: މ.ޏ.ށ.ބ$֏, reason: contains not printable characters */
    public static class C2318 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public long f7344 = 0;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public C2318 f7345;

        public String toString() {
            if (this.f7345 == null) {
                return Long.toBinaryString(this.f7344);
            }
            return this.f7345.toString() + "xx" + Long.toBinaryString(this.f7344);
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final void m4372() {
            if (this.f7345 == null) {
                this.f7345 = new C2318();
            }
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void m4373(int i) {
            if (i < 64) {
                this.f7344 &= ~(1 << i);
                return;
            }
            C2318 c2318 = this.f7345;
            if (c2318 != null) {
                c2318.m4373(i - 64);
            }
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void m4374(int i, boolean z) {
            if (i >= 64) {
                m4372();
                this.f7345.m4374(i - 64, z);
                return;
            }
            boolean z2 = (this.f7344 & Long.MIN_VALUE) != 0;
            long j = (1 << i) - 1;
            long j2 = this.f7344;
            this.f7344 = ((j2 & (~j)) << 1) | (j2 & j);
            if (z) {
                m4379(i);
            } else {
                m4373(i);
            }
            if (z2 || this.f7345 != null) {
                m4372();
                this.f7345.m4374(0, z2);
            }
        }

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public int m4375(int i) {
            C2318 c2318 = this.f7345;
            if (c2318 == null) {
                return i >= 64 ? Long.bitCount(this.f7344) : Long.bitCount(this.f7344 & ((1 << i) - 1));
            }
            if (i < 64) {
                return Long.bitCount(this.f7344 & ((1 << i) - 1));
            }
            return Long.bitCount(this.f7344) + c2318.m4375(i - 64);
        }

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public void m4376() {
            this.f7344 = 0L;
            C2318 c2318 = this.f7345;
            if (c2318 != null) {
                c2318.m4376();
            }
        }

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public boolean m4377(int i) {
            if (i < 64) {
                return (this.f7344 & (1 << i)) != 0;
            }
            m4372();
            return this.f7345.m4377(i - 64);
        }

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public boolean m4378(int i) {
            if (i >= 64) {
                m4372();
                return this.f7345.m4378(i - 64);
            }
            long j = 1 << i;
            boolean z = (this.f7344 & j) != 0;
            long j2 = this.f7344 & (~j);
            this.f7344 = j2;
            long j3 = j - 1;
            this.f7344 = (j2 & j3) | Long.rotateRight((~j3) & j2, 1);
            C2318 c2318 = this.f7345;
            if (c2318 != null) {
                if (c2318.m4377(0)) {
                    m4379(63);
                }
                this.f7345.m4378(0);
            }
            return z;
        }

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public void m4379(int i) {
            if (i < 64) {
                this.f7344 |= 1 << i;
            } else {
                m4372();
                this.f7345.m4379(i - 64);
            }
        }
    }

    /* JADX INFO: renamed from: މ.ޏ.ށ.ބ$ؠ, reason: contains not printable characters */
    public interface InterfaceC2319 {
    }

    public C2317(InterfaceC2319 interfaceC2319) {
        this.f7341 = interfaceC2319;
    }

    public String toString() {
        return this.f7342.toString() + ", hidden list:" + this.f7343.size();
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public int m4360() {
        return ((C2366) this.f7341).m4422() - this.f7343.size();
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m4361(int i) {
        RecyclerView.AbstractC0224 abstractC0224M527;
        int iM4368 = m4368(i);
        this.f7342.m4378(iM4368);
        C2366 c2366 = (C2366) this.f7341;
        View childAt = c2366.f7511.getChildAt(iM4368);
        if (childAt != null && (abstractC0224M527 = RecyclerView.m527(childAt)) != null) {
            if (abstractC0224M527.m750() && !abstractC0224M527.m754()) {
                StringBuilder sb = new StringBuilder();
                sb.append("called detach on an already detached child ");
                sb.append(abstractC0224M527);
                throw new IllegalArgumentException(C2803.m4867(c2366.f7511, sb));
            }
            abstractC0224M527.m734(256);
        }
        c2366.f7511.detachViewFromParent(iM4368);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m4362(View view) {
        this.f7343.add(view);
        C2366 c2366 = (C2366) this.f7341;
        if (c2366 == null) {
            throw null;
        }
        RecyclerView.AbstractC0224 abstractC0224M527 = RecyclerView.m527(view);
        if (abstractC0224M527 != null) {
            RecyclerView recyclerView = c2366.f7511;
            int i = abstractC0224M527.f1342;
            if (i != -1) {
                abstractC0224M527.f1341 = i;
            } else {
                abstractC0224M527.f1341 = C1920.m3758(abstractC0224M527.f1326);
            }
            recyclerView.m550(abstractC0224M527, 4);
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m4363(View view, int i, ViewGroup.LayoutParams layoutParams, boolean z) {
        int iM4422 = i < 0 ? ((C2366) this.f7341).m4422() : m4368(i);
        this.f7342.m4374(iM4422, z);
        if (z) {
            m4362(view);
        }
        C2366 c2366 = (C2366) this.f7341;
        if (c2366 == null) {
            throw null;
        }
        RecyclerView.AbstractC0224 abstractC0224M527 = RecyclerView.m527(view);
        if (abstractC0224M527 != null) {
            if (!abstractC0224M527.m750() && !abstractC0224M527.m754()) {
                StringBuilder sb = new StringBuilder();
                sb.append("Called attach on a child which is not detached: ");
                sb.append(abstractC0224M527);
                throw new IllegalArgumentException(C2803.m4867(c2366.f7511, sb));
            }
            abstractC0224M527.f1335 &= -257;
        }
        c2366.f7511.attachViewToParent(view, iM4422, layoutParams);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m4364(View view, int i, boolean z) {
        int iM4422 = i < 0 ? ((C2366) this.f7341).m4422() : m4368(i);
        this.f7342.m4374(iM4422, z);
        if (z) {
            m4362(view);
        }
        C2366 c2366 = (C2366) this.f7341;
        c2366.f7511.addView(view, iM4422);
        RecyclerView recyclerView = c2366.f7511;
        if (recyclerView == null) {
            throw null;
        }
        RecyclerView.AbstractC0224 abstractC0224M527 = RecyclerView.m527(view);
        RecyclerView.AbstractC0191 abstractC0191 = recyclerView.f1168;
        if (abstractC0191 == null || abstractC0224M527 == null) {
            return;
        }
        abstractC0191.mo329(abstractC0224M527);
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public int m4365() {
        return ((C2366) this.f7341).m4422();
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public int m4366(View view) {
        int iIndexOfChild = ((C2366) this.f7341).f7511.indexOfChild(view);
        if (iIndexOfChild == -1 || this.f7342.m4377(iIndexOfChild)) {
            return -1;
        }
        return iIndexOfChild - this.f7342.m4375(iIndexOfChild);
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public View m4367(int i) {
        return ((C2366) this.f7341).m4423(m4368(i));
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final int m4368(int i) {
        if (i < 0) {
            return -1;
        }
        int iM4422 = ((C2366) this.f7341).m4422();
        int i2 = i;
        while (i2 < iM4422) {
            int iM4375 = i - (i2 - this.f7342.m4375(i2));
            if (iM4375 == 0) {
                while (this.f7342.m4377(i2)) {
                    i2++;
                }
                return i2;
            }
            i2 += iM4375;
        }
        return -1;
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public boolean m4369(View view) {
        return this.f7343.contains(view);
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public View m4370(int i) {
        return ((C2366) this.f7341).f7511.getChildAt(i);
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final boolean m4371(View view) {
        if (!this.f7343.remove(view)) {
            return false;
        }
        C2366 c2366 = (C2366) this.f7341;
        if (c2366 == null) {
            throw null;
        }
        RecyclerView.AbstractC0224 abstractC0224M527 = RecyclerView.m527(view);
        if (abstractC0224M527 == null) {
            return true;
        }
        c2366.f7511.m550(abstractC0224M527, abstractC0224M527.f1341);
        abstractC0224M527.f1341 = 0;
        return true;
    }
}
