package X6FRs_4.IMuAHx_6.Nm6q_10;

import java.util.Locale;
/* compiled from: TextDirectionHeuristicsCompat.java */
/* loaded from: classes.dex */
public final class X6FRs_4 {
    public static final X6FRs_4.IMuAHx_6.Nm6q_10.Mqv2r_3 KQgRr5e_0 = new C0043X6FRs_4(null, false);
    public static final X6FRs_4.IMuAHx_6.Nm6q_10.Mqv2r_3 QxJ9d_1 = new C0043X6FRs_4(null, true);
    public static final X6FRs_4.IMuAHx_6.Nm6q_10.Mqv2r_3 PGPF6hQ_2 = new C0043X6FRs_4(QxJ9d_1.KQgRr5e_0, false);

    /* renamed from: Mqv2r_3  reason: collision with root package name */
    public static final X6FRs_4.IMuAHx_6.Nm6q_10.Mqv2r_3 f3118Mqv2r_3 = new C0043X6FRs_4(QxJ9d_1.KQgRr5e_0, true);

    /* compiled from: TextDirectionHeuristicsCompat.java */
    /* loaded from: classes.dex */
    public static class IFxWkV_5 extends Mqv2r_3 {
        public static final IFxWkV_5 KQgRr5e_0 = new IFxWkV_5();

        public IFxWkV_5() {
            super(null);
        }

        @Override // X6FRs_4.IMuAHx_6.Nm6q_10.X6FRs_4.Mqv2r_3
        public boolean KQgRr5e_0() {
            return X6FRs_4.IMuAHx_6.Nm6q_10.IFxWkV_5.QxJ9d_1(Locale.getDefault()) == 1;
        }
    }

    /* compiled from: TextDirectionHeuristicsCompat.java */
    /* loaded from: classes.dex */
    public static class KQgRr5e_0 implements PGPF6hQ_2 {
        public static final KQgRr5e_0 KQgRr5e_0 = new KQgRr5e_0(true);

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public final boolean f486KQgRr5e_0;

        public KQgRr5e_0(boolean z) {
            this.f486KQgRr5e_0 = z;
        }

        @Override // X6FRs_4.IMuAHx_6.Nm6q_10.X6FRs_4.PGPF6hQ_2
        public int KQgRr5e_0(CharSequence charSequence, int i, int i2) {
            int i3 = i2 + i;
            boolean z = false;
            while (i < i3) {
                int KQgRr5e_02 = X6FRs_4.KQgRr5e_0(Character.getDirectionality(charSequence.charAt(i)));
                if (KQgRr5e_02 != 0) {
                    if (KQgRr5e_02 != 1) {
                        continue;
                        i++;
                    } else if (!this.f486KQgRr5e_0) {
                        return 1;
                    }
                } else if (this.f486KQgRr5e_0) {
                    return 0;
                }
                z = true;
                i++;
            }
            if (z) {
                return this.f486KQgRr5e_0 ? 1 : 0;
            }
            return 2;
        }
    }

    /* compiled from: TextDirectionHeuristicsCompat.java */
    /* loaded from: classes.dex */
    public static abstract class Mqv2r_3 implements X6FRs_4.IMuAHx_6.Nm6q_10.Mqv2r_3 {
        public final PGPF6hQ_2 KQgRr5e_0;

        public Mqv2r_3(PGPF6hQ_2 pGPF6hQ_2) {
            this.KQgRr5e_0 = pGPF6hQ_2;
        }

        public abstract boolean KQgRr5e_0();

        @Override // X6FRs_4.IMuAHx_6.Nm6q_10.Mqv2r_3
        public boolean KQgRr5e_0(CharSequence charSequence, int i, int i2) {
            if (charSequence != null && i >= 0 && i2 >= 0 && charSequence.length() - i2 >= i) {
                if (this.KQgRr5e_0 == null) {
                    return KQgRr5e_0();
                }
                return QxJ9d_1(charSequence, i, i2);
            }
            throw new IllegalArgumentException();
        }

        public final boolean QxJ9d_1(CharSequence charSequence, int i, int i2) {
            int KQgRr5e_0 = this.KQgRr5e_0.KQgRr5e_0(charSequence, i, i2);
            if (KQgRr5e_0 != 0) {
                if (KQgRr5e_0 != 1) {
                    return KQgRr5e_0();
                }
                return false;
            }
            return true;
        }
    }

    /* compiled from: TextDirectionHeuristicsCompat.java */
    /* loaded from: classes.dex */
    public interface PGPF6hQ_2 {
        int KQgRr5e_0(CharSequence charSequence, int i, int i2);
    }

    /* compiled from: TextDirectionHeuristicsCompat.java */
    /* loaded from: classes.dex */
    public static class QxJ9d_1 implements PGPF6hQ_2 {
        public static final QxJ9d_1 KQgRr5e_0 = new QxJ9d_1();

        @Override // X6FRs_4.IMuAHx_6.Nm6q_10.X6FRs_4.PGPF6hQ_2
        public int KQgRr5e_0(CharSequence charSequence, int i, int i2) {
            int i3 = i2 + i;
            int i4 = 2;
            while (i < i3 && i4 == 2) {
                i4 = X6FRs_4.QxJ9d_1(Character.getDirectionality(charSequence.charAt(i)));
                i++;
            }
            return i4;
        }
    }

    /* compiled from: TextDirectionHeuristicsCompat.java */
    /* renamed from: X6FRs_4.IMuAHx_6.Nm6q_10.X6FRs_4$X6FRs_4  reason: collision with other inner class name */
    /* loaded from: classes.dex */
    public static class C0043X6FRs_4 extends Mqv2r_3 {
        public final boolean KQgRr5e_0;

        public C0043X6FRs_4(PGPF6hQ_2 pGPF6hQ_2, boolean z) {
            super(pGPF6hQ_2);
            this.KQgRr5e_0 = z;
        }

        @Override // X6FRs_4.IMuAHx_6.Nm6q_10.X6FRs_4.Mqv2r_3
        public boolean KQgRr5e_0() {
            return this.KQgRr5e_0;
        }
    }

    static {
        new C0043X6FRs_4(KQgRr5e_0.KQgRr5e_0, false);
        IFxWkV_5 iFxWkV_5 = IFxWkV_5.KQgRr5e_0;
    }

    public static int KQgRr5e_0(int i) {
        if (i != 0) {
            return (i == 1 || i == 2) ? 0 : 2;
        }
        return 1;
    }

    public static int QxJ9d_1(int i) {
        if (i != 0) {
            if (i == 1 || i == 2) {
                return 0;
            }
            switch (i) {
                case 14:
                case 15:
                    break;
                case 16:
                case 17:
                    return 0;
                default:
                    return 2;
            }
        }
        return 1;
    }
}
