package dd;

import androidx.media3.common.MimeTypes;
import org.json.JSONException;
import org.json.JSONObject;

/* JADX INFO: loaded from: classes.dex */
public final class n0 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final String f25138a;

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final int f25140c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final int f25141d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final int f25142e;

    public n0(int i10, int i11, int i12, int i13, String str) {
        if (!(i10 == -1 && i11 == -1) && (i10 < 0 || i11 < 0)) {
            throw new IndexOutOfBoundsException("invalid selection: (" + String.valueOf(i10) + ", " + String.valueOf(i11) + ")");
        }
        if (!(i12 == -1 && i13 == -1) && (i12 < 0 || i12 > i13)) {
            throw new IndexOutOfBoundsException("invalid composing range: (" + String.valueOf(i12) + ", " + String.valueOf(i13) + ")");
        }
        if (i13 > str.length()) {
            throw new IndexOutOfBoundsException("invalid composing start: " + String.valueOf(i12));
        }
        if (i10 > str.length()) {
            throw new IndexOutOfBoundsException("invalid selection start: " + String.valueOf(i10));
        }
        if (i11 > str.length()) {
            throw new IndexOutOfBoundsException("invalid selection end: " + String.valueOf(i11));
        }
        this.f25138a = str;
        this.f25139b = i10;
        this.f25140c = i11;
        this.f25141d = i12;
        this.f25142e = i13;
    }

    public static n0 a(JSONObject jSONObject) throws JSONException {
        return new n0(jSONObject.getInt("selectionBase"), jSONObject.getInt("selectionExtent"), jSONObject.getInt("composingBase"), jSONObject.getInt("composingExtent"), jSONObject.getString(MimeTypes.BASE_TYPE_TEXT));
    }
}
