package h0;

import android.util.Log;
import java.util.ArrayList;
import java.util.LinkedHashSet;

/* JADX INFO: loaded from: classes.dex */
public final class N implements L {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ P f13049a;

    public N(P p3) {
        this.f13049a = p3;
    }

    @Override // h0.L
    public final boolean a(ArrayList arrayList, ArrayList arrayList2) {
        ArrayList arrayList3;
        ArrayList arrayList4;
        boolean zV;
        P p3 = this.f13049a;
        p3.getClass();
        if (P.L(2)) {
            Log.v("FragmentManager", "FragmentManager has the following pending actions inside of prepareBackStackState: " + p3.f13067a);
        }
        int i = 0;
        if (p3.f13070d.isEmpty()) {
            Log.i("FragmentManager", "Ignoring call to start back stack pop because the back stack is empty.");
            arrayList3 = arrayList;
            arrayList4 = arrayList2;
            zV = false;
        } else {
            ArrayList arrayList5 = p3.f13070d;
            C1001a c1001a = (C1001a) arrayList5.get(arrayList5.size() - 1);
            p3.f13074h = c1001a;
            ArrayList arrayList6 = c1001a.f13144a;
            int size = arrayList6.size();
            int i5 = 0;
            while (i5 < size) {
                Object obj = arrayList6.get(i5);
                i5++;
                ComponentCallbacksC1023x componentCallbacksC1023x = ((X) obj).f13129b;
                if (componentCallbacksC1023x != null) {
                    componentCallbacksC1023x.f13259C = true;
                }
            }
            arrayList3 = arrayList;
            arrayList4 = arrayList2;
            zV = p3.V(arrayList3, arrayList4, null, -1, 0);
        }
        if (!p3.f13079n.isEmpty() && arrayList3.size() > 0) {
            ((Boolean) arrayList4.get(arrayList3.size() - 1)).getClass();
            LinkedHashSet<ComponentCallbacksC1023x> linkedHashSet = new LinkedHashSet();
            int size2 = arrayList3.size();
            int i8 = 0;
            while (i8 < size2) {
                Object obj2 = arrayList3.get(i8);
                i8++;
                linkedHashSet.addAll(P.F((C1001a) obj2));
            }
            ArrayList arrayList7 = p3.f13079n;
            int size3 = arrayList7.size();
            while (i < size3) {
                Object obj3 = arrayList7.get(i);
                i++;
                K k8 = (K) obj3;
                for (ComponentCallbacksC1023x componentCallbacksC1023x2 : linkedHashSet) {
                    k8.getClass();
                }
            }
        }
        return zV;
    }
}
