mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-19 04:13:18 +01:00
231 lines
14 KiB
Java
231 lines
14 KiB
Java
package androidx.compose.ui.text.input;
|
|
|
|
import androidx.compose.runtime.internal.StabilityInferred;
|
|
import androidx.compose.ui.text.AnnotatedString;
|
|
import androidx.compose.ui.text.TextRange;
|
|
import androidx.compose.ui.text.TextRangeKt;
|
|
import androidx.compose.ui.text.internal.InlineClassHelperKt;
|
|
import com.dee.app.metrics.MetricsConstants;
|
|
import defpackage.a$$ExternalSyntheticOutline0;
|
|
import kotlin.Metadata;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.SourceDebugExtension;
|
|
import kotlin.text.Regex$$ExternalSyntheticBUOutline0;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
import rx.Single$$ExternalSyntheticBUOutline0;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@StabilityInferred(parameters = 0)
|
|
@Metadata(d1 = {"\u0000F\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\r\n\u0002\u0010\u000b\n\u0002\b\n\n\u0002\u0010\f\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0002\b\u0012\b\u0007\u0018\u0000 =2\u00020\u0001:\u0001=B\u0017\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0004\b\u0006\u0010\u0007B\u0019\b\u0010\u0012\u0006\u0010\u0002\u001a\u00020\b\u0012\u0006\u0010\u0004\u001a\u00020\u0005¢\u0006\u0004\b\u0006\u0010\tJ\r\u0010\u001a\u001a\u00020\u001bH\u0000¢\u0006\u0002\b\u001cJ\u0016\u0010%\u001a\u00020&2\u0006\u0010'\u001a\u00020\rH\u0080\u0002¢\u0006\u0002\b(J%\u0010+\u001a\u00020,2\u0006\u0010-\u001a\u00020\r2\u0006\u0010.\u001a\u00020\r2\u0006\u0010\u0002\u001a\u00020\u0003H\u0000¢\u0006\u0002\b/J%\u0010+\u001a\u00020,2\u0006\u0010-\u001a\u00020\r2\u0006\u0010.\u001a\u00020\r2\u0006\u0010\u0002\u001a\u00020\bH\u0000¢\u0006\u0002\b/J\u001d\u00100\u001a\u00020,2\u0006\u0010-\u001a\u00020\r2\u0006\u0010.\u001a\u00020\rH\u0000¢\u0006\u0002\b1J\u001d\u00102\u001a\u00020,2\u0006\u0010-\u001a\u00020\r2\u0006\u0010.\u001a\u00020\rH\u0000¢\u0006\u0002\b3J\u001d\u00104\u001a\u00020,2\u0006\u0010-\u001a\u00020\r2\u0006\u0010.\u001a\u00020\rH\u0000¢\u0006\u0002\b5J\r\u00106\u001a\u00020,H\u0000¢\u0006\u0002\b7J\r\u00108\u001a\u00020,H\u0000¢\u0006\u0002\b9J\b\u0010:\u001a\u00020\bH\u0016J\r\u0010;\u001a\u00020\u0003H\u0000¢\u0006\u0002\b<R\u000e\u0010\n\u001a\u00020\u000bX\u0082\u0004¢\u0006\u0002\n\u0000R$\u0010\u000e\u001a\u00020\r2\u0006\u0010\f\u001a\u00020\r@BX\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u000f\u0010\u0010\"\u0004\b\u0011\u0010\u0012R$\u0010\u0013\u001a\u00020\r2\u0006\u0010\f\u001a\u00020\r@BX\u0080\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u0014\u0010\u0010\"\u0004\b\u0015\u0010\u0012R\u001e\u0010\u0016\u001a\u00020\r2\u0006\u0010\f\u001a\u00020\r@BX\u0080\u000e¢\u0006\b\n\u0000\u001a\u0004\b\u0017\u0010\u0010R\u001e\u0010\u0018\u001a\u00020\r2\u0006\u0010\f\u001a\u00020\r@BX\u0080\u000e¢\u0006\b\n\u0000\u001a\u0004\b\u0019\u0010\u0010R\u0016\u0010\u001d\u001a\u0004\u0018\u00010\u00058@X\u0080\u0004¢\u0006\u0006\u001a\u0004\b\u001e\u0010\u001fR\u0014\u0010\u0004\u001a\u00020\u00058@X\u0080\u0004¢\u0006\u0006\u001a\u0004\b \u0010!R$\u0010\"\u001a\u00020\r2\u0006\u0010\"\u001a\u00020\r8@@@X\u0080\u000e¢\u0006\f\u001a\u0004\b#\u0010\u0010\"\u0004\b$\u0010\u0012R\u0014\u0010)\u001a\u00020\r8@X\u0080\u0004¢\u0006\u0006\u001a\u0004\b*\u0010\u0010¨\u0006>"}, d2 = {"Landroidx/compose/ui/text/input/EditingBuffer;", "", "text", "Landroidx/compose/ui/text/AnnotatedString;", "selection", "Landroidx/compose/ui/text/TextRange;", "<init>", "(Landroidx/compose/ui/text/AnnotatedString;JLkotlin/jvm/internal/DefaultConstructorMarker;)V", "", "(Ljava/lang/String;JLkotlin/jvm/internal/DefaultConstructorMarker;)V", "gapBuffer", "Landroidx/compose/ui/text/input/PartialGapBuffer;", "value", "", "selectionStart", "getSelectionStart$ui_text", "()I", "setSelectionStart", "(I)V", "selectionEnd", "getSelectionEnd$ui_text", "setSelectionEnd", "compositionStart", "getCompositionStart$ui_text", "compositionEnd", "getCompositionEnd$ui_text", "hasComposition", "", "hasComposition$ui_text", "composition", "getComposition-MzsxiRA$ui_text", "()Landroidx/compose/ui/text/TextRange;", "getSelection-d9O1mEE$ui_text", "()J", "cursor", "getCursor$ui_text", "setCursor$ui_text", MetricsConstants.Method.CACHE_GET, "", "index", "get$ui_text", "length", "getLength$ui_text", "replace", "", "start", "end", "replace$ui_text", "delete", "delete$ui_text", "setSelection", "setSelection$ui_text", "setComposition", "setComposition$ui_text", "cancelComposition", "cancelComposition$ui_text", "commitComposition", "commitComposition$ui_text", "toString", "toAnnotatedString", "toAnnotatedString$ui_text", "Companion", "ui-text"}, k = 1, mv = {2, 0, 0}, xi = 48)
|
|
@SourceDebugExtension({"SMAP\nEditingBuffer.kt\nKotlin\n*S Kotlin\n*F\n+ 1 EditingBuffer.kt\nandroidx/compose/ui/text/input/EditingBuffer\n+ 2 InlineClassHelper.kt\nandroidx/compose/ui/text/internal/InlineClassHelperKt\n*L\n1#1,382:1\n118#2,4:383\n118#2,4:387\n*S KotlinDebug\n*F\n+ 1 EditingBuffer.kt\nandroidx/compose/ui/text/input/EditingBuffer\n*L\n50#1:383,4\n59#1:387,4\n*E\n"})
|
|
/* loaded from: classes13.dex */
|
|
public final class EditingBuffer {
|
|
public static final int NOWHERE = -1;
|
|
private int compositionEnd;
|
|
private int compositionStart;
|
|
|
|
@NotNull
|
|
private final PartialGapBuffer gapBuffer;
|
|
private int selectionEnd;
|
|
private int selectionStart;
|
|
public static final int $stable = 8;
|
|
|
|
private EditingBuffer(AnnotatedString annotatedString, long j) {
|
|
this.gapBuffer = new PartialGapBuffer(annotatedString.getText());
|
|
this.selectionStart = TextRange.m6828getMinimpl(j);
|
|
this.selectionEnd = TextRange.m6827getMaximpl(j);
|
|
this.compositionStart = -1;
|
|
this.compositionEnd = -1;
|
|
int m6828getMinimpl = TextRange.m6828getMinimpl(j);
|
|
int m6827getMaximpl = TextRange.m6827getMaximpl(j);
|
|
if (m6828getMinimpl < 0 || m6828getMinimpl > annotatedString.length()) {
|
|
Regex$$ExternalSyntheticBUOutline0.m(annotatedString.length(), a$$ExternalSyntheticOutline0.m0m(m6828getMinimpl, "start (", ") offset is outside of text region "));
|
|
throw null;
|
|
}
|
|
if (m6827getMaximpl < 0 || m6827getMaximpl > annotatedString.length()) {
|
|
Regex$$ExternalSyntheticBUOutline0.m(annotatedString.length(), a$$ExternalSyntheticOutline0.m0m(m6827getMaximpl, "end (", ") offset is outside of text region "));
|
|
throw null;
|
|
}
|
|
if (m6828getMinimpl <= m6827getMaximpl) {
|
|
return;
|
|
}
|
|
Single$$ExternalSyntheticBUOutline0.m$3(a$$ExternalSyntheticOutline0.m("Do not set reversed range: ", m6828getMinimpl, " > ", m6827getMaximpl));
|
|
throw null;
|
|
}
|
|
|
|
private final void setSelectionEnd(int i) {
|
|
if (!(i >= 0)) {
|
|
InlineClassHelperKt.throwIllegalArgumentException("Cannot set selectionEnd to a negative value: " + i);
|
|
}
|
|
this.selectionEnd = i;
|
|
}
|
|
|
|
private final void setSelectionStart(int i) {
|
|
if (!(i >= 0)) {
|
|
InlineClassHelperKt.throwIllegalArgumentException("Cannot set selectionStart to a negative value: " + i);
|
|
}
|
|
this.selectionStart = i;
|
|
}
|
|
|
|
public final void cancelComposition$ui_text() {
|
|
replace$ui_text(this.compositionStart, this.compositionEnd, "");
|
|
this.compositionStart = -1;
|
|
this.compositionEnd = -1;
|
|
}
|
|
|
|
public final void commitComposition$ui_text() {
|
|
this.compositionStart = -1;
|
|
this.compositionEnd = -1;
|
|
}
|
|
|
|
public final void delete$ui_text(int start, int end) {
|
|
long TextRange = TextRangeKt.TextRange(start, end);
|
|
this.gapBuffer.replace(start, end, "");
|
|
long m6995updateRangeAfterDeletepWDy79M = EditingBufferKt.m6995updateRangeAfterDeletepWDy79M(TextRangeKt.TextRange(this.selectionStart, this.selectionEnd), TextRange);
|
|
setSelectionStart(TextRange.m6828getMinimpl(m6995updateRangeAfterDeletepWDy79M));
|
|
setSelectionEnd(TextRange.m6827getMaximpl(m6995updateRangeAfterDeletepWDy79M));
|
|
if (hasComposition$ui_text()) {
|
|
long m6995updateRangeAfterDeletepWDy79M2 = EditingBufferKt.m6995updateRangeAfterDeletepWDy79M(TextRangeKt.TextRange(this.compositionStart, this.compositionEnd), TextRange);
|
|
if (TextRange.m6824getCollapsedimpl(m6995updateRangeAfterDeletepWDy79M2)) {
|
|
commitComposition$ui_text();
|
|
} else {
|
|
this.compositionStart = TextRange.m6828getMinimpl(m6995updateRangeAfterDeletepWDy79M2);
|
|
this.compositionEnd = TextRange.m6827getMaximpl(m6995updateRangeAfterDeletepWDy79M2);
|
|
}
|
|
}
|
|
}
|
|
|
|
public final char get$ui_text(int index) {
|
|
return this.gapBuffer.get(index);
|
|
}
|
|
|
|
@Nullable
|
|
/* renamed from: getComposition-MzsxiRA$ui_text, reason: not valid java name */
|
|
public final TextRange m6993getCompositionMzsxiRA$ui_text() {
|
|
if (hasComposition$ui_text()) {
|
|
return TextRange.m6818boximpl(TextRangeKt.TextRange(this.compositionStart, this.compositionEnd));
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/* renamed from: getCompositionEnd$ui_text, reason: from getter */
|
|
public final int getCompositionEnd() {
|
|
return this.compositionEnd;
|
|
}
|
|
|
|
/* renamed from: getCompositionStart$ui_text, reason: from getter */
|
|
public final int getCompositionStart() {
|
|
return this.compositionStart;
|
|
}
|
|
|
|
public final int getCursor$ui_text() {
|
|
int i = this.selectionStart;
|
|
int i2 = this.selectionEnd;
|
|
if (i == i2) {
|
|
return i2;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
public final int getLength$ui_text() {
|
|
return this.gapBuffer.getLength();
|
|
}
|
|
|
|
/* renamed from: getSelection-d9O1mEE$ui_text, reason: not valid java name */
|
|
public final long m6994getSelectiond9O1mEE$ui_text() {
|
|
return TextRangeKt.TextRange(this.selectionStart, this.selectionEnd);
|
|
}
|
|
|
|
/* renamed from: getSelectionEnd$ui_text, reason: from getter */
|
|
public final int getSelectionEnd() {
|
|
return this.selectionEnd;
|
|
}
|
|
|
|
/* renamed from: getSelectionStart$ui_text, reason: from getter */
|
|
public final int getSelectionStart() {
|
|
return this.selectionStart;
|
|
}
|
|
|
|
public final boolean hasComposition$ui_text() {
|
|
return this.compositionStart != -1;
|
|
}
|
|
|
|
public final void replace$ui_text(int start, int end, @NotNull String text) {
|
|
if (start < 0 || start > this.gapBuffer.getLength()) {
|
|
Regex$$ExternalSyntheticBUOutline0.m(this.gapBuffer.getLength(), a$$ExternalSyntheticOutline0.m0m(start, "start (", ") offset is outside of text region "));
|
|
return;
|
|
}
|
|
if (end < 0 || end > this.gapBuffer.getLength()) {
|
|
Regex$$ExternalSyntheticBUOutline0.m(this.gapBuffer.getLength(), a$$ExternalSyntheticOutline0.m0m(end, "end (", ") offset is outside of text region "));
|
|
} else {
|
|
if (start > end) {
|
|
Single$$ExternalSyntheticBUOutline0.m$3(a$$ExternalSyntheticOutline0.m("Do not set reversed range: ", start, " > ", end));
|
|
return;
|
|
}
|
|
this.gapBuffer.replace(start, end, text);
|
|
setSelectionStart(text.length() + start);
|
|
setSelectionEnd(text.length() + start);
|
|
this.compositionStart = -1;
|
|
this.compositionEnd = -1;
|
|
}
|
|
}
|
|
|
|
public final void setComposition$ui_text(int start, int end) {
|
|
if (start < 0 || start > this.gapBuffer.getLength()) {
|
|
Regex$$ExternalSyntheticBUOutline0.m(this.gapBuffer.getLength(), a$$ExternalSyntheticOutline0.m0m(start, "start (", ") offset is outside of text region "));
|
|
} else if (end < 0 || end > this.gapBuffer.getLength()) {
|
|
Regex$$ExternalSyntheticBUOutline0.m(this.gapBuffer.getLength(), a$$ExternalSyntheticOutline0.m0m(end, "end (", ") offset is outside of text region "));
|
|
} else if (start >= end) {
|
|
Single$$ExternalSyntheticBUOutline0.m$3(a$$ExternalSyntheticOutline0.m("Do not set reversed or empty range: ", start, " > ", end));
|
|
} else {
|
|
this.compositionStart = start;
|
|
this.compositionEnd = end;
|
|
}
|
|
}
|
|
|
|
public final void setCursor$ui_text(int i) {
|
|
setSelection$ui_text(i, i);
|
|
}
|
|
|
|
public final void setSelection$ui_text(int start, int end) {
|
|
if (start < 0 || start > this.gapBuffer.getLength()) {
|
|
Regex$$ExternalSyntheticBUOutline0.m(this.gapBuffer.getLength(), a$$ExternalSyntheticOutline0.m0m(start, "start (", ") offset is outside of text region "));
|
|
} else if (end < 0 || end > this.gapBuffer.getLength()) {
|
|
Regex$$ExternalSyntheticBUOutline0.m(this.gapBuffer.getLength(), a$$ExternalSyntheticOutline0.m0m(end, "end (", ") offset is outside of text region "));
|
|
} else if (start > end) {
|
|
Single$$ExternalSyntheticBUOutline0.m$3(a$$ExternalSyntheticOutline0.m("Do not set reversed range: ", start, " > ", end));
|
|
} else {
|
|
setSelectionStart(start);
|
|
setSelectionEnd(end);
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@NotNull
|
|
public final AnnotatedString toAnnotatedString$ui_text() {
|
|
return new AnnotatedString(toString(), null, 2, 0 == true ? 1 : 0);
|
|
}
|
|
|
|
@NotNull
|
|
public String toString() {
|
|
return this.gapBuffer.toString();
|
|
}
|
|
|
|
public final void replace$ui_text(int start, int end, @NotNull AnnotatedString text) {
|
|
replace$ui_text(start, end, text.getText());
|
|
}
|
|
|
|
public /* synthetic */ EditingBuffer(String str, long j, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(str, j);
|
|
}
|
|
|
|
public /* synthetic */ EditingBuffer(AnnotatedString annotatedString, long j, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(annotatedString, j);
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
private EditingBuffer(String str, long j) {
|
|
this(new AnnotatedString(str, null, 2, 0 == true ? 1 : 0), j, (DefaultConstructorMarker) (0 == true ? 1 : 0));
|
|
}
|
|
}
|