package K;

import android.net.Uri;
import android.util.SparseBooleanArray;
import com.google.android.gms.internal.measurement.I1;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import m4.C1174j;
import m4.InterfaceC1175k;
import u0.C1577m;
import x0.AbstractC1709a;

/* JADX INFO: loaded from: classes.dex */
public final class g implements InterfaceC1175k {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public boolean f3523a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final Object f3524b;

    public g(Uri uri, boolean z8, boolean z9) {
        this.f3524b = uri;
        this.f3523a = z8;
    }

    @Override // m4.InterfaceC1175k
    public void a(C1174j c1174j, int i) {
        boolean z8 = this.f3523a;
        StringBuilder sb = (StringBuilder) this.f3524b;
        if (z8) {
            this.f3523a = false;
        } else {
            sb.append(", ");
        }
        sb.append(i);
    }

    public void b(int i) {
        AbstractC1709a.j(!this.f3523a);
        ((SparseBooleanArray) this.f3524b).append(i, true);
    }

    public C1577m c() {
        AbstractC1709a.j(!this.f3523a);
        this.f3523a = true;
        return new C1577m((SparseBooleanArray) this.f3524b);
    }

    public boolean d() {
        return this.f3523a;
    }

    /* JADX WARN: Removed duplicated region for block: B:21:0x0036  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public boolean e(int i, CharSequence charSequence) {
        if (charSequence == null || i < 0 || charSequence.length() - i < 0) {
            throw new IllegalArgumentException();
        }
        if (((f) this.f3524b) == null) {
            return d();
        }
        char c3 = 2;
        for (int i5 = 0; i5 < i && c3 == 2; i5++) {
            byte directionality = Character.getDirectionality(charSequence.charAt(i5));
            g gVar = h.f3525a;
            if (directionality == 0) {
                c3 = 1;
                continue;
            } else if (directionality != 1 && directionality != 2) {
                switch (directionality) {
                    case 14:
                    case 15:
                        break;
                    case 16:
                    case 17:
                        c3 = 0;
                        break;
                    default:
                        c3 = 2;
                        continue;
                }
            } else {
                c3 = 0;
            }
        }
        if (c3 == 0) {
            return true;
        }
        if (c3 != 1) {
            return d();
        }
        return false;
    }

    public I1 f(long j8, String str) {
        Long lValueOf = Long.valueOf(j8);
        Object obj = I1.f9605g;
        return new I1(this, str, lValueOf, 0);
    }

    public I1 g(String str, String str2) {
        Object obj = I1.f9605g;
        return new I1(this, str, str2, 3);
    }

    public I1 h(String str, boolean z8) {
        Boolean boolValueOf = Boolean.valueOf(z8);
        Object obj = I1.f9605g;
        return new I1(this, str, boolValueOf, 1);
    }

    public /* synthetic */ g(Object obj) {
        this.f3524b = obj;
        this.f3523a = true;
    }

    public g() {
        this.f3524b = new SparseBooleanArray();
    }

    public g(f fVar, boolean z8) {
        this.f3524b = fVar;
        this.f3523a = z8;
    }

    public g(BottomSheetBehavior bottomSheetBehavior, boolean z8) {
        this.f3524b = bottomSheetBehavior;
        this.f3523a = z8;
    }
}
