package d;

import java.util.ListIterator;
import n4.u0;

/* JADX INFO: loaded from: classes.dex */
public final class p extends P6.h implements O6.l {

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final /* synthetic */ int f11310r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final /* synthetic */ x f11311s;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public /* synthetic */ p(x xVar, int i) {
        super(1);
        this.f11310r = i;
        this.f11311s = xVar;
    }

    @Override // O6.l
    public final Object b(Object obj) {
        Object objPrevious;
        Object objPrevious2;
        switch (this.f11310r) {
            case u0.f15495q /* 0 */:
                b bVar = (b) obj;
                P6.g.e(bVar, "backEvent");
                x xVar = this.f11311s;
                B6.i iVar = xVar.f11329b;
                ListIterator listIterator = iVar.listIterator(iVar.a());
                while (true) {
                    if (listIterator.hasPrevious()) {
                        objPrevious = listIterator.previous();
                        if (((o) objPrevious).f11307a) {
                        }
                    } else {
                        objPrevious = null;
                    }
                }
                o oVar = (o) objPrevious;
                xVar.f11330c = oVar;
                if (oVar != null) {
                    oVar.d(bVar);
                }
                break;
            default:
                b bVar2 = (b) obj;
                P6.g.e(bVar2, "backEvent");
                x xVar2 = this.f11311s;
                o oVar2 = xVar2.f11330c;
                if (oVar2 == null) {
                    B6.i iVar2 = xVar2.f11329b;
                    ListIterator listIterator2 = iVar2.listIterator(iVar2.a());
                    while (true) {
                        if (listIterator2.hasPrevious()) {
                            objPrevious2 = listIterator2.previous();
                            if (((o) objPrevious2).f11307a) {
                            }
                        } else {
                            objPrevious2 = null;
                        }
                    }
                    oVar2 = (o) objPrevious2;
                }
                if (oVar2 != null) {
                    oVar2.c(bVar2);
                }
                break;
        }
        return A6.n.f457a;
    }
}
