package p402.p420;

import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import p402.C6541;
import p402.p411.p412.InterfaceC6618;
import p402.p411.p413.AbstractC6636;
import p402.p411.p413.C6635;
import p402.p417.C6662;

/* JADX INFO: renamed from: ގ.ޔ.ދ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C6705 extends AbstractC6636 implements InterfaceC6618<CharSequence, Integer, C6541<? extends Integer, ? extends Integer>> {

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final /* synthetic */ List f19468;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final /* synthetic */ boolean f19469;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C6705(List list, boolean z) {
        super(2);
        this.f19468 = list;
        this.f19469 = z;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:57:0x00dd A[EDGE_INSN: B:64:0x00dd->B:57:0x00dd BREAK  A[LOOP:0: B:28:0x0068->B:39:0x009b], EDGE_INSN: B:70:0x00dd->B:57:0x00dd BREAK  A[LOOP:2: B:45:0x00aa->B:56:0x00db]] */
    /* JADX WARN: Removed duplicated region for block: B:57:0x00dd A[EDGE_INSN: B:64:0x00dd->B:57:0x00dd BREAK  A[LOOP:0: B:28:0x0068->B:39:0x009b]] */
    @Override // p402.p411.p412.InterfaceC6618
    /* JADX INFO: renamed from: ؠ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public C6541<? extends Integer, ? extends Integer> mo838(CharSequence charSequence, Integer num) {
        Object next;
        C6541 c6541;
        Object next2;
        CharSequence charSequence2 = charSequence;
        int iIntValue = num.intValue();
        if (charSequence2 == null) {
            C6635.m9824("$receiver");
            throw null;
        }
        List list = this.f19468;
        boolean z = this.f19469;
        if (z || list.size() != 1) {
            if (iIntValue < 0) {
                iIntValue = 0;
            }
            C6662 c6662 = new C6662(iIntValue, charSequence2.length());
            if (charSequence2 instanceof String) {
                int i = c6662.f19412;
                int i2 = c6662.f19413;
                int i3 = c6662.f19414;
                if (i3 < 0 ? i < i2 : i > i2) {
                    c6541 = null;
                } else {
                    while (true) {
                        Iterator it = list.iterator();
                        while (true) {
                            if (!it.hasNext()) {
                                next2 = null;
                                break;
                            }
                            next2 = it.next();
                            String str = (String) next2;
                            if (C6703.m9882(str, 0, (String) charSequence2, i, str.length(), z)) {
                                break;
                            }
                        }
                        String str2 = (String) next2;
                        if (str2 == null) {
                            if (i == i2) {
                                break;
                            }
                            i += i3;
                        } else {
                            c6541 = new C6541(Integer.valueOf(i), str2);
                            break;
                        }
                    }
                    c6541 = null;
                }
            } else {
                int i4 = c6662.f19412;
                int i5 = c6662.f19413;
                int i6 = c6662.f19414;
                if (i6 < 0 ? i4 >= i5 : i4 <= i5) {
                    while (true) {
                        Iterator it2 = list.iterator();
                        while (true) {
                            if (!it2.hasNext()) {
                                next = null;
                                break;
                            }
                            next = it2.next();
                            String str3 = (String) next;
                            if (C6703.m9879(str3, 0, charSequence2, i4, str3.length(), z)) {
                                break;
                            }
                        }
                        String str4 = (String) next;
                        if (str4 == null) {
                            if (i4 == i5) {
                                break;
                            }
                            i4 += i6;
                        } else {
                            c6541 = new C6541(Integer.valueOf(i4), str4);
                            break;
                        }
                    }
                    c6541 = null;
                }
            }
        } else {
            int size = list.size();
            if (size == 0) {
                throw new NoSuchElementException("List is empty.");
            }
            if (size != 1) {
                throw new IllegalArgumentException("List has more than one element.");
            }
            String str5 = (String) list.get(0);
            int iM9860 = C6703.m9860(charSequence2, str5, iIntValue, false, 4);
            if (iM9860 >= 0) {
                c6541 = new C6541(Integer.valueOf(iM9860), str5);
            }
        }
        if (c6541 != null) {
            return new C6541<>(c6541.f19316, Integer.valueOf(((String) c6541.f19317).length()));
        }
        return null;
    }
}
