mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
114 lines
5.2 KiB
Java
114 lines
5.2 KiB
Java
![]() |
package androidx.compose.ui.text.input;
|
||
|
|
||
|
import io.sentry.SentryEnvelopeItemHeader;
|
||
|
import kotlin.Metadata;
|
||
|
import kotlin.jvm.internal.Intrinsics;
|
||
|
|
||
|
/* compiled from: GapBuffer.kt */
|
||
|
@Metadata(d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0010\f\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0005\b\u0007\u0018\u0000 \u00182\u00020\u0001:\u0001\u0018B\r\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004J\u0011\u0010\u0010\u001a\u00020\u00112\u0006\u0010\u0012\u001a\u00020\u0006H\u0086\u0002J\u001e\u0010\u0013\u001a\u00020\u00142\u0006\u0010\u0015\u001a\u00020\u00062\u0006\u0010\u0016\u001a\u00020\u00062\u0006\u0010\u0002\u001a\u00020\u0003J\b\u0010\u0017\u001a\u00020\u0003H\u0016R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0006X\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\b\u001a\u0004\u0018\u00010\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u0011\u0010\n\u001a\u00020\u00068F¢\u0006\u0006\u001a\u0004\b\u000b\u0010\fR\u001a\u0010\u0002\u001a\u00020\u0003X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\r\u0010\u000e\"\u0004\b\u000f\u0010\u0004¨\u0006\u0019"}, d2 = {"Landroidx/compose/ui/text/input/PartialGapBuffer;", "", "text", "", "(Ljava/lang/String;)V", "bufEnd", "", "bufStart", "buffer", "Landroidx/compose/ui/text/input/GapBuffer;", SentryEnvelopeItemHeader.JsonKeys.LENGTH, "getLength", "()I", "getText", "()Ljava/lang/String;", "setText", "get", "", "index", "replace", "", "start", "end", "toString", "Companion", "ui-text_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class PartialGapBuffer {
|
||
|
public static final int BUF_SIZE = 255;
|
||
|
public static final int NOWHERE = -1;
|
||
|
public static final int SURROUNDING_SIZE = 64;
|
||
|
private int bufEnd;
|
||
|
private int bufStart;
|
||
|
private GapBuffer buffer;
|
||
|
private String text;
|
||
|
public static final int $stable = 8;
|
||
|
|
||
|
public final String getText() {
|
||
|
return this.text;
|
||
|
}
|
||
|
|
||
|
public final void setText(String str) {
|
||
|
Intrinsics.checkNotNullParameter(str, "<set-?>");
|
||
|
this.text = str;
|
||
|
}
|
||
|
|
||
|
public PartialGapBuffer(String text) {
|
||
|
Intrinsics.checkNotNullParameter(text, "text");
|
||
|
this.text = text;
|
||
|
this.bufStart = -1;
|
||
|
this.bufEnd = -1;
|
||
|
}
|
||
|
|
||
|
public final int getLength() {
|
||
|
GapBuffer gapBuffer = this.buffer;
|
||
|
if (gapBuffer == null) {
|
||
|
return this.text.length();
|
||
|
}
|
||
|
return (this.text.length() - (this.bufEnd - this.bufStart)) + gapBuffer.length();
|
||
|
}
|
||
|
|
||
|
public final void replace(int start, int end, String text) {
|
||
|
Intrinsics.checkNotNullParameter(text, "text");
|
||
|
if (start > end) {
|
||
|
throw new IllegalArgumentException(("start index must be less than or equal to end index: " + start + " > " + end).toString());
|
||
|
}
|
||
|
if (start < 0) {
|
||
|
throw new IllegalArgumentException(("start must be non-negative, but was " + start).toString());
|
||
|
}
|
||
|
GapBuffer gapBuffer = this.buffer;
|
||
|
if (gapBuffer == null) {
|
||
|
int max = Math.max(255, text.length() + 128);
|
||
|
char[] cArr = new char[max];
|
||
|
int min = Math.min(start, 64);
|
||
|
int min2 = Math.min(this.text.length() - end, 64);
|
||
|
int i = start - min;
|
||
|
GapBuffer_jvmKt.toCharArray(this.text, cArr, 0, i, start);
|
||
|
int i2 = max - min2;
|
||
|
int i3 = min2 + end;
|
||
|
GapBuffer_jvmKt.toCharArray(this.text, cArr, i2, end, i3);
|
||
|
GapBufferKt.toCharArray(text, cArr, min);
|
||
|
this.buffer = new GapBuffer(cArr, min + text.length(), i2);
|
||
|
this.bufStart = i;
|
||
|
this.bufEnd = i3;
|
||
|
return;
|
||
|
}
|
||
|
int i4 = this.bufStart;
|
||
|
int i5 = start - i4;
|
||
|
int i6 = end - i4;
|
||
|
if (i5 < 0 || i6 > gapBuffer.length()) {
|
||
|
this.text = toString();
|
||
|
this.buffer = null;
|
||
|
this.bufStart = -1;
|
||
|
this.bufEnd = -1;
|
||
|
replace(start, end, text);
|
||
|
return;
|
||
|
}
|
||
|
gapBuffer.replace(i5, i6, text);
|
||
|
}
|
||
|
|
||
|
public final char get(int index) {
|
||
|
GapBuffer gapBuffer = this.buffer;
|
||
|
if (gapBuffer == null) {
|
||
|
return this.text.charAt(index);
|
||
|
}
|
||
|
if (index < this.bufStart) {
|
||
|
return this.text.charAt(index);
|
||
|
}
|
||
|
int length = gapBuffer.length();
|
||
|
int i = this.bufStart;
|
||
|
if (index < length + i) {
|
||
|
return gapBuffer.get(index - i);
|
||
|
}
|
||
|
return this.text.charAt(index - ((length - this.bufEnd) + i));
|
||
|
}
|
||
|
|
||
|
public String toString() {
|
||
|
GapBuffer gapBuffer = this.buffer;
|
||
|
if (gapBuffer == null) {
|
||
|
return this.text;
|
||
|
}
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.append((CharSequence) this.text, 0, this.bufStart);
|
||
|
gapBuffer.append(sb);
|
||
|
String str = this.text;
|
||
|
sb.append((CharSequence) str, this.bufEnd, str.length());
|
||
|
String sb2 = sb.toString();
|
||
|
Intrinsics.checkNotNullExpressionValue(sb2, "sb.toString()");
|
||
|
return sb2;
|
||
|
}
|
||
|
}
|