package Z0;

import J2.L;
import a1.AbstractC0958a;

/* JADX INFO: renamed from: Z0.f, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0865f implements InterfaceC0866g {

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

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

    public C0865f(int i6, int i7) {
        this.f9102a = i6;
        this.f9103b = i7;
        if (i6 >= 0 && i7 >= 0) {
            return;
        }
        AbstractC0958a.a("Expected lengthBeforeCursor and lengthAfterCursor to be non-negative, were " + i6 + " and " + i7 + " respectively.");
    }

    @Override // Z0.InterfaceC0866g
    public final void a(C0867h c0867h) {
        int i6 = 0;
        int i7 = 0;
        int i8 = 0;
        while (true) {
            if (i7 < this.f9102a) {
                int i9 = i8 + 1;
                int i10 = c0867h.f9105b;
                if (i10 <= i9) {
                    i8 = i10;
                    break;
                } else {
                    i8 = (Character.isHighSurrogate(c0867h.b((i10 - i9) + (-1))) && Character.isLowSurrogate(c0867h.b(c0867h.f9105b - i9))) ? i8 + 2 : i9;
                    i7++;
                }
            } else {
                break;
            }
        }
        int iP = 0;
        while (true) {
            if (i6 >= this.f9103b) {
                break;
            }
            int i11 = iP + 1;
            int i12 = c0867h.f9106c + i11;
            L l = c0867h.f9104a;
            if (i12 >= l.p()) {
                iP = l.p() - c0867h.f9106c;
                break;
            } else {
                iP = (Character.isHighSurrogate(c0867h.b((c0867h.f9106c + i11) + (-1))) && Character.isLowSurrogate(c0867h.b(c0867h.f9106c + i11))) ? iP + 2 : i11;
                i6++;
            }
        }
        int i13 = c0867h.f9106c;
        c0867h.a(i13, iP + i13);
        int i14 = c0867h.f9105b;
        c0867h.a(i14 - i8, i14);
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof C0865f)) {
            return false;
        }
        C0865f c0865f = (C0865f) obj;
        return this.f9102a == c0865f.f9102a && this.f9103b == c0865f.f9103b;
    }

    public final int hashCode() {
        return (this.f9102a * 31) + this.f9103b;
    }

    public final String toString() {
        StringBuilder sb = new StringBuilder("DeleteSurroundingTextInCodePointsCommand(lengthBeforeCursor=");
        sb.append(this.f9102a);
        sb.append(", lengthAfterCursor=");
        return com.google.android.recaptcha.internal.a.m(sb, this.f9103b, ')');
    }
}
