package FSaI4_7.KNBe_11;

import FSaI4_7.IFxWkV_5.LGe8pk_15;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
/* compiled from: Strings.kt */
/* loaded from: classes.dex */
public class EuDEkJe_12 extends KNBe_11 {

    /* compiled from: Strings.kt */
    /* loaded from: classes.dex */
    public static final class KQgRr5e_0 extends FSaI4_7.Xgtqvk_8.QxJ9d_1.IMuAHx_6 implements FSaI4_7.Xgtqvk_8.KQgRr5e_0.QxJ9d_1<CharSequence, Integer, FSaI4_7.QxJ9d_1<? extends Integer, ? extends Integer>> {
        public final /* synthetic */ List KQgRr5e_0;
        public final /* synthetic */ boolean QxJ9d_1;

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

        public final FSaI4_7.QxJ9d_1<Integer, Integer> KQgRr5e_0(CharSequence charSequence, int i) {
            FSaI4_7.Xgtqvk_8.QxJ9d_1.IFxWkV_5.QxJ9d_1(charSequence, "$receiver");
            FSaI4_7.QxJ9d_1 QxJ9d_1 = EuDEkJe_12.QxJ9d_1(charSequence, this.KQgRr5e_0, i, this.QxJ9d_1, false);
            if (QxJ9d_1 != null) {
                return FSaI4_7.PGPF6hQ_2.KQgRr5e_0(QxJ9d_1.PGPF6hQ_2(), Integer.valueOf(((String) QxJ9d_1.Mqv2r_3()).length()));
            }
            return null;
        }

        @Override // FSaI4_7.Xgtqvk_8.KQgRr5e_0.QxJ9d_1
        public /* bridge */ /* synthetic */ FSaI4_7.QxJ9d_1<? extends Integer, ? extends Integer> KQgRr5e_0(CharSequence charSequence, Integer num) {
            return KQgRr5e_0(charSequence, num.intValue());
        }
    }

    /* compiled from: Strings.kt */
    /* loaded from: classes.dex */
    public static final class QxJ9d_1 extends FSaI4_7.Xgtqvk_8.QxJ9d_1.IMuAHx_6 implements FSaI4_7.Xgtqvk_8.KQgRr5e_0.KQgRr5e_0<FSaI4_7.XnFJ5_9.PGPF6hQ_2, String> {
        public final /* synthetic */ CharSequence KQgRr5e_0;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public QxJ9d_1(CharSequence charSequence) {
            super(1);
            this.KQgRr5e_0 = charSequence;
        }

        @Override // FSaI4_7.Xgtqvk_8.KQgRr5e_0.KQgRr5e_0
        public final String KQgRr5e_0(FSaI4_7.XnFJ5_9.PGPF6hQ_2 pGPF6hQ_2) {
            FSaI4_7.Xgtqvk_8.QxJ9d_1.IFxWkV_5.QxJ9d_1(pGPF6hQ_2, "it");
            return EuDEkJe_12.KQgRr5e_0(this.KQgRr5e_0, pGPF6hQ_2);
        }
    }

    public static final FSaI4_7.QxJ9d_1<Integer, String> QxJ9d_1(CharSequence charSequence, Collection<String> collection, int i, boolean z, boolean z2) {
        Object obj;
        Object obj2;
        if (!z && collection.size() == 1) {
            String str = (String) LGe8pk_15.KQgRr5e_0(collection);
            int KQgRr5e_02 = !z2 ? KQgRr5e_0(charSequence, str, i, false, 4, (Object) null) : QxJ9d_1(charSequence, str, i, false, 4, null);
            if (KQgRr5e_02 < 0) {
                return null;
            }
            return FSaI4_7.PGPF6hQ_2.KQgRr5e_0(Integer.valueOf(KQgRr5e_02), str);
        }
        FSaI4_7.XnFJ5_9.KQgRr5e_0 pGPF6hQ_2 = !z2 ? new FSaI4_7.XnFJ5_9.PGPF6hQ_2(FSaI4_7.XnFJ5_9.IFxWkV_5.KQgRr5e_0(i, 0), charSequence.length()) : FSaI4_7.XnFJ5_9.IFxWkV_5.m7KQgRr5e_0(FSaI4_7.XnFJ5_9.IFxWkV_5.QxJ9d_1(i, KQgRr5e_0(charSequence)), 0);
        if (charSequence instanceof String) {
            int mo10KQgRr5e_0 = pGPF6hQ_2.mo10KQgRr5e_0();
            int QxJ9d_12 = pGPF6hQ_2.QxJ9d_1();
            int PGPF6hQ_2 = pGPF6hQ_2.PGPF6hQ_2();
            if (PGPF6hQ_2 <= 0 ? mo10KQgRr5e_0 >= QxJ9d_12 : mo10KQgRr5e_0 <= QxJ9d_12) {
                while (true) {
                    Iterator<T> it = collection.iterator();
                    while (true) {
                        if (!it.hasNext()) {
                            obj2 = null;
                            break;
                        }
                        obj2 = it.next();
                        String str2 = (String) obj2;
                        if (KNBe_11.KQgRr5e_0(str2, 0, (String) charSequence, mo10KQgRr5e_0, str2.length(), z)) {
                            break;
                        }
                    }
                    String str3 = (String) obj2;
                    if (str3 == null) {
                        if (mo10KQgRr5e_0 == QxJ9d_12) {
                            break;
                        }
                        mo10KQgRr5e_0 += PGPF6hQ_2;
                    } else {
                        return FSaI4_7.PGPF6hQ_2.KQgRr5e_0(Integer.valueOf(mo10KQgRr5e_0), str3);
                    }
                }
            }
        } else {
            int mo10KQgRr5e_02 = pGPF6hQ_2.mo10KQgRr5e_0();
            int QxJ9d_13 = pGPF6hQ_2.QxJ9d_1();
            int PGPF6hQ_22 = pGPF6hQ_2.PGPF6hQ_2();
            if (PGPF6hQ_22 <= 0 ? mo10KQgRr5e_02 >= QxJ9d_13 : mo10KQgRr5e_02 <= QxJ9d_13) {
                while (true) {
                    Iterator<T> it2 = collection.iterator();
                    while (true) {
                        if (!it2.hasNext()) {
                            obj = null;
                            break;
                        }
                        obj = it2.next();
                        String str4 = (String) obj;
                        if (KQgRr5e_0(str4, 0, charSequence, mo10KQgRr5e_02, str4.length(), z)) {
                            break;
                        }
                    }
                    String str5 = (String) obj;
                    if (str5 == null) {
                        if (mo10KQgRr5e_02 == QxJ9d_13) {
                            break;
                        }
                        mo10KQgRr5e_02 += PGPF6hQ_22;
                    } else {
                        return FSaI4_7.PGPF6hQ_2.KQgRr5e_0(Integer.valueOf(mo10KQgRr5e_02), str5);
                    }
                }
            }
        }
        return null;
    }

    public static final int KQgRr5e_0(CharSequence charSequence) {
        FSaI4_7.Xgtqvk_8.QxJ9d_1.IFxWkV_5.QxJ9d_1(charSequence, "$receiver");
        return charSequence.length() - 1;
    }

    public static final String KQgRr5e_0(CharSequence charSequence, FSaI4_7.XnFJ5_9.PGPF6hQ_2 pGPF6hQ_2) {
        FSaI4_7.Xgtqvk_8.QxJ9d_1.IFxWkV_5.QxJ9d_1(charSequence, "$receiver");
        FSaI4_7.Xgtqvk_8.QxJ9d_1.IFxWkV_5.QxJ9d_1(pGPF6hQ_2, "range");
        return charSequence.subSequence(pGPF6hQ_2.QxJ9d_1().intValue(), pGPF6hQ_2.mo10KQgRr5e_0().intValue() + 1).toString();
    }

    public static final boolean KQgRr5e_0(CharSequence charSequence, int i, CharSequence charSequence2, int i2, int i3, boolean z) {
        FSaI4_7.Xgtqvk_8.QxJ9d_1.IFxWkV_5.QxJ9d_1(charSequence, "$receiver");
        FSaI4_7.Xgtqvk_8.QxJ9d_1.IFxWkV_5.QxJ9d_1(charSequence2, "other");
        if (i2 < 0 || i < 0 || i > charSequence.length() - i3 || i2 > charSequence2.length() - i3) {
            return false;
        }
        for (int i4 = 0; i4 < i3; i4++) {
            if (!FSaI4_7.KNBe_11.QxJ9d_1.KQgRr5e_0(charSequence.charAt(i + i4), charSequence2.charAt(i2 + i4), z)) {
                return false;
            }
        }
        return true;
    }

    public static /* bridge */ /* synthetic */ int KQgRr5e_0(CharSequence charSequence, CharSequence charSequence2, int i, int i2, boolean z, boolean z2, int i3, Object obj) {
        return KQgRr5e_0(charSequence, charSequence2, i, i2, z, (i3 & 16) != 0 ? false : z2);
    }

    public static final int KQgRr5e_0(CharSequence charSequence, CharSequence charSequence2, int i, int i2, boolean z, boolean z2) {
        FSaI4_7.XnFJ5_9.KQgRr5e_0 m7KQgRr5e_0;
        if (!z2) {
            m7KQgRr5e_0 = new FSaI4_7.XnFJ5_9.PGPF6hQ_2(FSaI4_7.XnFJ5_9.IFxWkV_5.KQgRr5e_0(i, 0), FSaI4_7.XnFJ5_9.IFxWkV_5.QxJ9d_1(i2, charSequence.length()));
        } else {
            m7KQgRr5e_0 = FSaI4_7.XnFJ5_9.IFxWkV_5.m7KQgRr5e_0(FSaI4_7.XnFJ5_9.IFxWkV_5.QxJ9d_1(i, KQgRr5e_0(charSequence)), FSaI4_7.XnFJ5_9.IFxWkV_5.KQgRr5e_0(i2, 0));
        }
        if ((charSequence instanceof String) && (charSequence2 instanceof String)) {
            int mo10KQgRr5e_0 = m7KQgRr5e_0.mo10KQgRr5e_0();
            int QxJ9d_12 = m7KQgRr5e_0.QxJ9d_1();
            int PGPF6hQ_2 = m7KQgRr5e_0.PGPF6hQ_2();
            if (PGPF6hQ_2 > 0) {
                if (mo10KQgRr5e_0 > QxJ9d_12) {
                    return -1;
                }
            } else if (mo10KQgRr5e_0 < QxJ9d_12) {
                return -1;
            }
            while (!KNBe_11.KQgRr5e_0((String) charSequence2, 0, (String) charSequence, mo10KQgRr5e_0, charSequence2.length(), z)) {
                if (mo10KQgRr5e_0 == QxJ9d_12) {
                    return -1;
                }
                mo10KQgRr5e_0 += PGPF6hQ_2;
            }
            return mo10KQgRr5e_0;
        }
        int mo10KQgRr5e_02 = m7KQgRr5e_0.mo10KQgRr5e_0();
        int QxJ9d_13 = m7KQgRr5e_0.QxJ9d_1();
        int PGPF6hQ_22 = m7KQgRr5e_0.PGPF6hQ_2();
        if (PGPF6hQ_22 > 0) {
            if (mo10KQgRr5e_02 > QxJ9d_13) {
                return -1;
            }
        } else if (mo10KQgRr5e_02 < QxJ9d_13) {
            return -1;
        }
        while (!KQgRr5e_0(charSequence2, 0, charSequence, mo10KQgRr5e_02, charSequence2.length(), z)) {
            if (mo10KQgRr5e_02 == QxJ9d_13) {
                return -1;
            }
            mo10KQgRr5e_02 += PGPF6hQ_22;
        }
        return mo10KQgRr5e_02;
    }

    public static /* bridge */ /* synthetic */ int KQgRr5e_0(CharSequence charSequence, String str, int i, boolean z, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            i = 0;
        }
        if ((i2 & 4) != 0) {
            z = false;
        }
        return KQgRr5e_0(charSequence, str, i, z);
    }

    public static final int KQgRr5e_0(CharSequence charSequence, String str, int i, boolean z) {
        FSaI4_7.Xgtqvk_8.QxJ9d_1.IFxWkV_5.QxJ9d_1(charSequence, "$receiver");
        FSaI4_7.Xgtqvk_8.QxJ9d_1.IFxWkV_5.QxJ9d_1(str, "string");
        if (!z && (charSequence instanceof String)) {
            return ((String) charSequence).indexOf(str, i);
        }
        return KQgRr5e_0(charSequence, str, i, charSequence.length(), z, false, 16, null);
    }

    public static /* bridge */ /* synthetic */ int QxJ9d_1(CharSequence charSequence, String str, int i, boolean z, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            i = KQgRr5e_0(charSequence);
        }
        if ((i2 & 4) != 0) {
            z = false;
        }
        return QxJ9d_1(charSequence, str, i, z);
    }

    public static final int QxJ9d_1(CharSequence charSequence, String str, int i, boolean z) {
        FSaI4_7.Xgtqvk_8.QxJ9d_1.IFxWkV_5.QxJ9d_1(charSequence, "$receiver");
        FSaI4_7.Xgtqvk_8.QxJ9d_1.IFxWkV_5.QxJ9d_1(str, "string");
        if (!z && (charSequence instanceof String)) {
            return ((String) charSequence).lastIndexOf(str, i);
        }
        return KQgRr5e_0(charSequence, (CharSequence) str, i, 0, z, true);
    }

    public static /* bridge */ /* synthetic */ boolean KQgRr5e_0(CharSequence charSequence, CharSequence charSequence2, boolean z, int i, Object obj) {
        if ((i & 2) != 0) {
            z = false;
        }
        return KQgRr5e_0(charSequence, charSequence2, z);
    }

    public static final boolean KQgRr5e_0(CharSequence charSequence, CharSequence charSequence2, boolean z) {
        FSaI4_7.Xgtqvk_8.QxJ9d_1.IFxWkV_5.QxJ9d_1(charSequence, "$receiver");
        FSaI4_7.Xgtqvk_8.QxJ9d_1.IFxWkV_5.QxJ9d_1(charSequence2, "other");
        if (charSequence2 instanceof String) {
            if (KQgRr5e_0(charSequence, (String) charSequence2, 0, z, 2, (Object) null) >= 0) {
                return true;
            }
        } else if (KQgRr5e_0(charSequence, charSequence2, 0, charSequence.length(), z, false, 16, null) >= 0) {
            return true;
        }
        return false;
    }

    public static /* bridge */ /* synthetic */ FSaI4_7.Nm6q_10.KQgRr5e_0 KQgRr5e_0(CharSequence charSequence, String[] strArr, int i, boolean z, int i2, int i3, Object obj) {
        if ((i3 & 2) != 0) {
            i = 0;
        }
        if ((i3 & 4) != 0) {
            z = false;
        }
        if ((i3 & 8) != 0) {
            i2 = 0;
        }
        return KQgRr5e_0(charSequence, strArr, i, z, i2);
    }

    public static final FSaI4_7.Nm6q_10.KQgRr5e_0<FSaI4_7.XnFJ5_9.PGPF6hQ_2> KQgRr5e_0(CharSequence charSequence, String[] strArr, int i, boolean z, int i2) {
        if (i2 >= 0) {
            return new Mqv2r_3(charSequence, i, i2, new KQgRr5e_0(FSaI4_7.IFxWkV_5.Mqv2r_3.KQgRr5e_0(strArr), z));
        }
        throw new IllegalArgumentException(("Limit must be non-negative, but was " + i2 + '.').toString());
    }

    public static /* bridge */ /* synthetic */ FSaI4_7.Nm6q_10.KQgRr5e_0 KQgRr5e_0(CharSequence charSequence, String[] strArr, boolean z, int i, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            z = false;
        }
        if ((i2 & 4) != 0) {
            i = 0;
        }
        return KQgRr5e_0(charSequence, strArr, z, i);
    }

    public static final FSaI4_7.Nm6q_10.KQgRr5e_0<String> KQgRr5e_0(CharSequence charSequence, String[] strArr, boolean z, int i) {
        FSaI4_7.Xgtqvk_8.QxJ9d_1.IFxWkV_5.QxJ9d_1(charSequence, "$receiver");
        FSaI4_7.Xgtqvk_8.QxJ9d_1.IFxWkV_5.QxJ9d_1(strArr, "delimiters");
        return FSaI4_7.Nm6q_10.X6FRs_4.KQgRr5e_0(KQgRr5e_0(charSequence, strArr, 0, z, i, 2, null), new QxJ9d_1(charSequence));
    }
}
