Rabbit-R1/switch port/java/sources/androidx/compose/ui/text/AnnotatedStringKt.java
2024-05-21 17:08:36 -04:00

437 lines
28 KiB
Java

package androidx.compose.ui.text;
import androidx.compose.ui.text.AnnotatedString;
import androidx.compose.ui.text.intl.LocaleList;
import androidx.exifinterface.media.ExifInterface;
import io.sentry.protocol.ViewHierarchyNode;
import java.util.ArrayList;
import java.util.List;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.functions.Function3;
import kotlin.jvm.internal.InlineMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.ranges.RangesKt;
/* compiled from: AnnotatedString.kt */
@Metadata(d1 = {"\u0000v\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u000b\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0000\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\t\u001a\u0016\u0010\u0002\u001a\u00020\u00012\u0006\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0005\u001a\u00020\u0006\u001a\"\u0010\u0002\u001a\u00020\u00012\u0006\u0010\u0003\u001a\u00020\u00042\u0006\u0010\u0007\u001a\u00020\b2\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u0006\u001a%\u0010\t\u001a\u00020\u00012\u0017\u0010\n\u001a\u0013\u0012\u0004\u0012\u00020\f\u0012\u0004\u0012\u00020\r0\u000b¢\u0006\u0002\b\u000eH\u0086\\u0001\u0000\u001a(\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0013\u001a\u00020\u00122\u0006\u0010\u0014\u001a\u00020\u00122\u0006\u0010\u0015\u001a\u00020\u0012H\u0000\u001a\b\u0010\u0016\u001a\u00020\u0001H\u0000\u001aD\u0010\u0017\u001a\u0010\u0012\n\u0012\b\u0012\u0004\u0012\u0002H\u001a0\u0019\u0018\u00010\u0018\"\u0004\b\u0000\u0010\u001a2\u0016\u0010\u001b\u001a\u0012\u0012\f\u0012\n\u0012\u0006\b\u0001\u0012\u0002H\u001a0\u0019\u0018\u00010\u00182\u0006\u0010\u001c\u001a\u00020\u00122\u0006\u0010\u001d\u001a\u00020\u0012H\u0002\u001a(\u0010\u001e\u001a\u00020\u00102\u0006\u0010\u001f\u001a\u00020\u00122\u0006\u0010 \u001a\u00020\u00122\u0006\u0010!\u001a\u00020\u00122\u0006\u0010\"\u001a\u00020\u0012H\u0000\u001a\u0014\u0010#\u001a\u00020\u0001*\u00020\u00012\b\b\u0002\u0010$\u001a\u00020%\u001a\u0014\u0010&\u001a\u00020\u0001*\u00020\u00012\b\b\u0002\u0010$\u001a\u00020%\u001a,\u0010'\u001a\u0012\u0012\f\u0012\n\u0012\u0006\b\u0001\u0012\u00020(0\u0019\u0018\u00010\u0018*\u00020\u00012\u0006\u0010\u001c\u001a\u00020\u00122\u0006\u0010\u001d\u001a\u00020\u0012H\u0002\u001a*\u0010)\u001a\u0010\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00060\u0019\u0018\u00010\u0018*\u00020\u00012\u0006\u0010\u001c\u001a\u00020\u00122\u0006\u0010\u001d\u001a\u00020\u0012H\u0002\u001a*\u0010*\u001a\u0010\u0012\n\u0012\b\u0012\u0004\u0012\u00020\b0\u0019\u0018\u00010\u0018*\u00020\u00012\u0006\u0010\u001c\u001a\u00020\u00122\u0006\u0010\u001d\u001a\u00020\u0012H\u0002\u001ad\u0010+\u001a\b\u0012\u0004\u0012\u0002H\u001a0\u0018\"\u0004\b\u0000\u0010\u001a*\u00020\u00012\u0006\u0010,\u001a\u00020\u00062>\b\u0004\u0010-\u001a8\u0012\u0013\u0012\u00110\u0001¢\u0006\f\b/\u0012\b\b0\u0012\u0004\b\b(1\u0012\u0019\u0012\u0017\u0012\u0004\u0012\u00020\u00060\u0019¢\u0006\f\b/\u0012\b\b0\u0012\u0004\b\b(\u0005\u0012\u0004\u0012\u0002H\u001a0.H\u0080\\u0001\u0000\u001a \u00102\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00060\u00190\u0018*\u00020\u00012\u0006\u0010,\u001a\u00020\u0006H\u0000\u001a\u001c\u00103\u001a\u00020\u0001*\u00020\u00012\u0006\u0010\u001c\u001a\u00020\u00122\u0006\u0010\u001d\u001a\u00020\u0012H\u0002\u001a\u0014\u00104\u001a\u00020\u0001*\u00020\u00012\b\b\u0002\u0010$\u001a\u00020%\u001a\u0014\u00105\u001a\u00020\u0001*\u00020\u00012\b\b\u0002\u0010$\u001a\u00020%\u001aB\u00106\u001a\u0002H7\"\b\b\u0000\u00107*\u00020(*\u00020\f2\u0006\u00108\u001a\u0002092\u0019\b\u0004\u0010-\u001a\u0013\u0012\u0004\u0012\u00020\f\u0012\u0004\u0012\u0002H70\u000b¢\u0006\u0002\b\u000eH\u0087\\u0001\u0000¢\u0006\u0002\u0010:\u001aB\u00106\u001a\u0002H7\"\b\b\u0000\u00107*\u00020(*\u00020\f2\u0006\u0010;\u001a\u00020<2\u0019\b\u0004\u0010-\u001a\u0013\u0012\u0004\u0012\u00020\f\u0012\u0004\u0012\u0002H70\u000b¢\u0006\u0002\b\u000eH\u0087\\u0001\u0000¢\u0006\u0002\u0010=\u001aJ\u00106\u001a\u0002H7\"\b\b\u0000\u00107*\u00020(*\u00020\f2\u0006\u0010>\u001a\u00020\u00042\u0006\u0010?\u001a\u00020\u00042\u0019\b\u0004\u0010-\u001a\u0013\u0012\u0004\u0012\u00020\f\u0012\u0004\u0012\u0002H70\u000b¢\u0006\u0002\b\u000eH\u0087\\u0001\u0000¢\u0006\u0002\u0010@\u001aB\u0010A\u001a\u0002H7\"\b\b\u0000\u00107*\u00020(*\u00020\f2\u0006\u0010B\u001a\u00020\u00062\u0019\b\u0004\u0010-\u001a\u0013\u0012\u0004\u0012\u00020\f\u0012\u0004\u0012\u0002H70\u000b¢\u0006\u0002\b\u000eH\u0086\\u0001\u0000¢\u0006\u0002\u0010C\u001a@\u0010A\u001a\u0002H7\"\b\b\u0000\u00107*\u00020(*\u00020\f2\u0006\u0010B\u001a\u00020\b2\u0017\u0010-\u001a\u0013\u0012\u0004\u0012\u00020\f\u0012\u0004\u0012\u0002H70\u000b¢\u0006\u0002\b\u000eH\u0086\\u0001\u0000¢\u0006\u0002\u0010D\"\u000e\u0010\u0000\u001a\u00020\u0001X\u0082\u0004¢\u0006\u0002\n\u0000\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006E"}, d2 = {"EmptyAnnotatedString", "Landroidx/compose/ui/text/AnnotatedString;", "AnnotatedString", "text", "", "paragraphStyle", "Landroidx/compose/ui/text/ParagraphStyle;", "spanStyle", "Landroidx/compose/ui/text/SpanStyle;", "buildAnnotatedString", "builder", "Lkotlin/Function1;", "Landroidx/compose/ui/text/AnnotatedString$Builder;", "", "Lkotlin/ExtensionFunctionType;", "contains", "", "baseStart", "", "baseEnd", "targetStart", "targetEnd", "emptyAnnotatedString", "filterRanges", "", "Landroidx/compose/ui/text/AnnotatedString$Range;", ExifInterface.GPS_DIRECTION_TRUE, "ranges", "start", "end", "intersect", "lStart", "lEnd", "rStart", "rEnd", "capitalize", "localeList", "Landroidx/compose/ui/text/intl/LocaleList;", "decapitalize", "getLocalAnnotations", "", "getLocalParagraphStyles", "getLocalSpanStyles", "mapEachParagraphStyle", "defaultParagraphStyle", "block", "Lkotlin/Function2;", "Lkotlin/ParameterName;", "name", "annotatedString", "normalizedParagraphStyles", "substringWithoutParagraphStyles", "toLowerCase", "toUpperCase", "withAnnotation", "R", "ttsAnnotation", "Landroidx/compose/ui/text/TtsAnnotation;", "(Landroidx/compose/ui/text/AnnotatedString$Builder;Landroidx/compose/ui/text/TtsAnnotation;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;", "urlAnnotation", "Landroidx/compose/ui/text/UrlAnnotation;", "(Landroidx/compose/ui/text/AnnotatedString$Builder;Landroidx/compose/ui/text/UrlAnnotation;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;", ViewHierarchyNode.JsonKeys.TAG, "annotation", "(Landroidx/compose/ui/text/AnnotatedString$Builder;Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;", "withStyle", "style", "(Landroidx/compose/ui/text/AnnotatedString$Builder;Landroidx/compose/ui/text/ParagraphStyle;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;", "(Landroidx/compose/ui/text/AnnotatedString$Builder;Landroidx/compose/ui/text/SpanStyle;Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;", "ui-text_release"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class AnnotatedStringKt {
private static final AnnotatedString EmptyAnnotatedString = new AnnotatedString("", null, null, 6, null);
public static final boolean contains(int i, int i2, int i3, int i4) {
if (i > i3 || i4 > i2) {
return false;
}
if (i2 == i4) {
if ((i3 == i4) != (i == i2)) {
return false;
}
}
return true;
}
public static final AnnotatedString emptyAnnotatedString() {
return EmptyAnnotatedString;
}
public static final List<AnnotatedString.Range<ParagraphStyle>> normalizedParagraphStyles(AnnotatedString annotatedString, ParagraphStyle defaultParagraphStyle) {
Intrinsics.checkNotNullParameter(annotatedString, "<this>");
Intrinsics.checkNotNullParameter(defaultParagraphStyle, "defaultParagraphStyle");
int length = annotatedString.getText().length();
List<AnnotatedString.Range<ParagraphStyle>> paragraphStylesOrNull$ui_text_release = annotatedString.getParagraphStylesOrNull$ui_text_release();
if (paragraphStylesOrNull$ui_text_release == null) {
paragraphStylesOrNull$ui_text_release = CollectionsKt.emptyList();
}
ArrayList arrayList = new ArrayList();
int size = paragraphStylesOrNull$ui_text_release.size();
int i = 0;
int i2 = 0;
while (i < size) {
AnnotatedString.Range<ParagraphStyle> range = paragraphStylesOrNull$ui_text_release.get(i);
ParagraphStyle component1 = range.component1();
int start = range.getStart();
int end = range.getEnd();
if (start != i2) {
arrayList.add(new AnnotatedString.Range(defaultParagraphStyle, i2, start));
}
arrayList.add(new AnnotatedString.Range(defaultParagraphStyle.merge(component1), start, end));
i++;
i2 = end;
}
if (i2 != length) {
arrayList.add(new AnnotatedString.Range(defaultParagraphStyle, i2, length));
}
if (arrayList.isEmpty()) {
arrayList.add(new AnnotatedString.Range(defaultParagraphStyle, 0, 0));
}
return arrayList;
}
public static final List<AnnotatedString.Range<SpanStyle>> getLocalSpanStyles(AnnotatedString annotatedString, int i, int i2) {
List<AnnotatedString.Range<SpanStyle>> spanStylesOrNull$ui_text_release;
if (i == i2 || (spanStylesOrNull$ui_text_release = annotatedString.getSpanStylesOrNull$ui_text_release()) == null) {
return null;
}
if (i == 0 && i2 >= annotatedString.getText().length()) {
return spanStylesOrNull$ui_text_release;
}
ArrayList arrayList = new ArrayList(spanStylesOrNull$ui_text_release.size());
int size = spanStylesOrNull$ui_text_release.size();
for (int i3 = 0; i3 < size; i3++) {
AnnotatedString.Range<SpanStyle> range = spanStylesOrNull$ui_text_release.get(i3);
AnnotatedString.Range<SpanStyle> range2 = range;
if (intersect(i, i2, range2.getStart(), range2.getEnd())) {
arrayList.add(range);
}
}
ArrayList arrayList2 = arrayList;
ArrayList arrayList3 = new ArrayList(arrayList2.size());
int size2 = arrayList2.size();
for (int i4 = 0; i4 < size2; i4++) {
AnnotatedString.Range range3 = (AnnotatedString.Range) arrayList2.get(i4);
arrayList3.add(new AnnotatedString.Range(range3.getItem(), RangesKt.coerceIn(range3.getStart(), i, i2) - i, RangesKt.coerceIn(range3.getEnd(), i, i2) - i));
}
return arrayList3;
}
public static final List<AnnotatedString.Range<ParagraphStyle>> getLocalParagraphStyles(AnnotatedString annotatedString, int i, int i2) {
List<AnnotatedString.Range<ParagraphStyle>> paragraphStylesOrNull$ui_text_release;
if (i == i2 || (paragraphStylesOrNull$ui_text_release = annotatedString.getParagraphStylesOrNull$ui_text_release()) == null) {
return null;
}
if (i == 0 && i2 >= annotatedString.getText().length()) {
return paragraphStylesOrNull$ui_text_release;
}
ArrayList arrayList = new ArrayList(paragraphStylesOrNull$ui_text_release.size());
int size = paragraphStylesOrNull$ui_text_release.size();
for (int i3 = 0; i3 < size; i3++) {
AnnotatedString.Range<ParagraphStyle> range = paragraphStylesOrNull$ui_text_release.get(i3);
AnnotatedString.Range<ParagraphStyle> range2 = range;
if (intersect(i, i2, range2.getStart(), range2.getEnd())) {
arrayList.add(range);
}
}
ArrayList arrayList2 = arrayList;
ArrayList arrayList3 = new ArrayList(arrayList2.size());
int size2 = arrayList2.size();
for (int i4 = 0; i4 < size2; i4++) {
AnnotatedString.Range range3 = (AnnotatedString.Range) arrayList2.get(i4);
arrayList3.add(new AnnotatedString.Range(range3.getItem(), RangesKt.coerceIn(range3.getStart(), i, i2) - i, RangesKt.coerceIn(range3.getEnd(), i, i2) - i));
}
return arrayList3;
}
public static final List<AnnotatedString.Range<? extends Object>> getLocalAnnotations(AnnotatedString annotatedString, int i, int i2) {
List<AnnotatedString.Range<? extends Object>> annotations$ui_text_release;
if (i == i2 || (annotations$ui_text_release = annotatedString.getAnnotations$ui_text_release()) == null) {
return null;
}
if (i == 0 && i2 >= annotatedString.getText().length()) {
return annotations$ui_text_release;
}
ArrayList arrayList = new ArrayList(annotations$ui_text_release.size());
int size = annotations$ui_text_release.size();
for (int i3 = 0; i3 < size; i3++) {
AnnotatedString.Range<? extends Object> range = annotations$ui_text_release.get(i3);
AnnotatedString.Range<? extends Object> range2 = range;
if (intersect(i, i2, range2.getStart(), range2.getEnd())) {
arrayList.add(range);
}
}
ArrayList arrayList2 = arrayList;
ArrayList arrayList3 = new ArrayList(arrayList2.size());
int size2 = arrayList2.size();
for (int i4 = 0; i4 < size2; i4++) {
AnnotatedString.Range range3 = (AnnotatedString.Range) arrayList2.get(i4);
arrayList3.add(new AnnotatedString.Range(range3.getItem(), RangesKt.coerceIn(range3.getStart(), i, i2) - i, RangesKt.coerceIn(range3.getEnd(), i, i2) - i, range3.getTag()));
}
return arrayList3;
}
public static final AnnotatedString substringWithoutParagraphStyles(AnnotatedString annotatedString, int i, int i2) {
String str;
if (i != i2) {
str = annotatedString.getText().substring(i, i2);
Intrinsics.checkNotNullExpressionValue(str, "this as java.lang.String…ing(startIndex, endIndex)");
} else {
str = "";
}
return new AnnotatedString(str, getLocalSpanStyles(annotatedString, i, i2), null, null, 12, null);
}
public static final <T> List<T> mapEachParagraphStyle(AnnotatedString annotatedString, ParagraphStyle defaultParagraphStyle, Function2<? super AnnotatedString, ? super AnnotatedString.Range<ParagraphStyle>, ? extends T> block) {
Intrinsics.checkNotNullParameter(annotatedString, "<this>");
Intrinsics.checkNotNullParameter(defaultParagraphStyle, "defaultParagraphStyle");
Intrinsics.checkNotNullParameter(block, "block");
List<AnnotatedString.Range<ParagraphStyle>> normalizedParagraphStyles = normalizedParagraphStyles(annotatedString, defaultParagraphStyle);
ArrayList arrayList = new ArrayList(normalizedParagraphStyles.size());
int size = normalizedParagraphStyles.size();
for (int i = 0; i < size; i++) {
AnnotatedString.Range<ParagraphStyle> range = normalizedParagraphStyles.get(i);
arrayList.add(block.invoke(substringWithoutParagraphStyles(annotatedString, range.getStart(), range.getEnd()), range));
}
return arrayList;
}
public static /* synthetic */ AnnotatedString toUpperCase$default(AnnotatedString annotatedString, LocaleList localeList, int i, Object obj) {
if ((i & 1) != 0) {
localeList = LocaleList.INSTANCE.getCurrent();
}
return toUpperCase(annotatedString, localeList);
}
public static final AnnotatedString toUpperCase(AnnotatedString annotatedString, final LocaleList localeList) {
Intrinsics.checkNotNullParameter(annotatedString, "<this>");
Intrinsics.checkNotNullParameter(localeList, "localeList");
return JvmAnnotatedString_jvmKt.transform(annotatedString, new Function3<String, Integer, Integer, String>() { // from class: androidx.compose.ui.text.AnnotatedStringKt$toUpperCase$1
/* JADX INFO: Access modifiers changed from: package-private */
{
super(3);
}
@Override // kotlin.jvm.functions.Function3
public /* bridge */ /* synthetic */ String invoke(String str, Integer num, Integer num2) {
return invoke(str, num.intValue(), num2.intValue());
}
public final String invoke(String str, int i, int i2) {
Intrinsics.checkNotNullParameter(str, "str");
String substring = str.substring(i, i2);
Intrinsics.checkNotNullExpressionValue(substring, "this as java.lang.String…ing(startIndex, endIndex)");
return StringKt.toUpperCase(substring, LocaleList.this);
}
});
}
public static /* synthetic */ AnnotatedString toLowerCase$default(AnnotatedString annotatedString, LocaleList localeList, int i, Object obj) {
if ((i & 1) != 0) {
localeList = LocaleList.INSTANCE.getCurrent();
}
return toLowerCase(annotatedString, localeList);
}
public static final AnnotatedString toLowerCase(AnnotatedString annotatedString, final LocaleList localeList) {
Intrinsics.checkNotNullParameter(annotatedString, "<this>");
Intrinsics.checkNotNullParameter(localeList, "localeList");
return JvmAnnotatedString_jvmKt.transform(annotatedString, new Function3<String, Integer, Integer, String>() { // from class: androidx.compose.ui.text.AnnotatedStringKt$toLowerCase$1
/* JADX INFO: Access modifiers changed from: package-private */
{
super(3);
}
@Override // kotlin.jvm.functions.Function3
public /* bridge */ /* synthetic */ String invoke(String str, Integer num, Integer num2) {
return invoke(str, num.intValue(), num2.intValue());
}
public final String invoke(String str, int i, int i2) {
Intrinsics.checkNotNullParameter(str, "str");
String substring = str.substring(i, i2);
Intrinsics.checkNotNullExpressionValue(substring, "this as java.lang.String…ing(startIndex, endIndex)");
return StringKt.toLowerCase(substring, LocaleList.this);
}
});
}
public static /* synthetic */ AnnotatedString capitalize$default(AnnotatedString annotatedString, LocaleList localeList, int i, Object obj) {
if ((i & 1) != 0) {
localeList = LocaleList.INSTANCE.getCurrent();
}
return capitalize(annotatedString, localeList);
}
public static final AnnotatedString capitalize(AnnotatedString annotatedString, final LocaleList localeList) {
Intrinsics.checkNotNullParameter(annotatedString, "<this>");
Intrinsics.checkNotNullParameter(localeList, "localeList");
return JvmAnnotatedString_jvmKt.transform(annotatedString, new Function3<String, Integer, Integer, String>() { // from class: androidx.compose.ui.text.AnnotatedStringKt$capitalize$1
/* JADX INFO: Access modifiers changed from: package-private */
{
super(3);
}
@Override // kotlin.jvm.functions.Function3
public /* bridge */ /* synthetic */ String invoke(String str, Integer num, Integer num2) {
return invoke(str, num.intValue(), num2.intValue());
}
public final String invoke(String str, int i, int i2) {
Intrinsics.checkNotNullParameter(str, "str");
if (i == 0) {
String substring = str.substring(i, i2);
Intrinsics.checkNotNullExpressionValue(substring, "this as java.lang.String…ing(startIndex, endIndex)");
return StringKt.capitalize(substring, LocaleList.this);
}
String substring2 = str.substring(i, i2);
Intrinsics.checkNotNullExpressionValue(substring2, "this as java.lang.String…ing(startIndex, endIndex)");
return substring2;
}
});
}
public static /* synthetic */ AnnotatedString decapitalize$default(AnnotatedString annotatedString, LocaleList localeList, int i, Object obj) {
if ((i & 1) != 0) {
localeList = LocaleList.INSTANCE.getCurrent();
}
return decapitalize(annotatedString, localeList);
}
public static final AnnotatedString decapitalize(AnnotatedString annotatedString, final LocaleList localeList) {
Intrinsics.checkNotNullParameter(annotatedString, "<this>");
Intrinsics.checkNotNullParameter(localeList, "localeList");
return JvmAnnotatedString_jvmKt.transform(annotatedString, new Function3<String, Integer, Integer, String>() { // from class: androidx.compose.ui.text.AnnotatedStringKt$decapitalize$1
/* JADX INFO: Access modifiers changed from: package-private */
{
super(3);
}
@Override // kotlin.jvm.functions.Function3
public /* bridge */ /* synthetic */ String invoke(String str, Integer num, Integer num2) {
return invoke(str, num.intValue(), num2.intValue());
}
public final String invoke(String str, int i, int i2) {
Intrinsics.checkNotNullParameter(str, "str");
if (i == 0) {
String substring = str.substring(i, i2);
Intrinsics.checkNotNullExpressionValue(substring, "this as java.lang.String…ing(startIndex, endIndex)");
return StringKt.decapitalize(substring, LocaleList.this);
}
String substring2 = str.substring(i, i2);
Intrinsics.checkNotNullExpressionValue(substring2, "this as java.lang.String…ing(startIndex, endIndex)");
return substring2;
}
});
}
public static final <R> R withStyle(AnnotatedString.Builder builder, SpanStyle style, Function1<? super AnnotatedString.Builder, ? extends R> block) {
Intrinsics.checkNotNullParameter(builder, "<this>");
Intrinsics.checkNotNullParameter(style, "style");
Intrinsics.checkNotNullParameter(block, "block");
int pushStyle = builder.pushStyle(style);
try {
return block.invoke(builder);
} finally {
InlineMarker.finallyStart(1);
builder.pop(pushStyle);
InlineMarker.finallyEnd(1);
}
}
public static final <R> R withStyle(AnnotatedString.Builder builder, ParagraphStyle style, Function1<? super AnnotatedString.Builder, ? extends R> block) {
Intrinsics.checkNotNullParameter(builder, "<this>");
Intrinsics.checkNotNullParameter(style, "style");
Intrinsics.checkNotNullParameter(block, "block");
int pushStyle = builder.pushStyle(style);
try {
return block.invoke(builder);
} finally {
InlineMarker.finallyStart(1);
builder.pop(pushStyle);
InlineMarker.finallyEnd(1);
}
}
public static final <R> R withAnnotation(AnnotatedString.Builder builder, String tag, String annotation, Function1<? super AnnotatedString.Builder, ? extends R> block) {
Intrinsics.checkNotNullParameter(builder, "<this>");
Intrinsics.checkNotNullParameter(tag, "tag");
Intrinsics.checkNotNullParameter(annotation, "annotation");
Intrinsics.checkNotNullParameter(block, "block");
int pushStringAnnotation = builder.pushStringAnnotation(tag, annotation);
try {
return block.invoke(builder);
} finally {
InlineMarker.finallyStart(1);
builder.pop(pushStringAnnotation);
InlineMarker.finallyEnd(1);
}
}
public static final <R> R withAnnotation(AnnotatedString.Builder builder, TtsAnnotation ttsAnnotation, Function1<? super AnnotatedString.Builder, ? extends R> block) {
Intrinsics.checkNotNullParameter(builder, "<this>");
Intrinsics.checkNotNullParameter(ttsAnnotation, "ttsAnnotation");
Intrinsics.checkNotNullParameter(block, "block");
int pushTtsAnnotation = builder.pushTtsAnnotation(ttsAnnotation);
try {
return block.invoke(builder);
} finally {
InlineMarker.finallyStart(1);
builder.pop(pushTtsAnnotation);
InlineMarker.finallyEnd(1);
}
}
public static final <R> R withAnnotation(AnnotatedString.Builder builder, UrlAnnotation urlAnnotation, Function1<? super AnnotatedString.Builder, ? extends R> block) {
Intrinsics.checkNotNullParameter(builder, "<this>");
Intrinsics.checkNotNullParameter(urlAnnotation, "urlAnnotation");
Intrinsics.checkNotNullParameter(block, "block");
int pushUrlAnnotation = builder.pushUrlAnnotation(urlAnnotation);
try {
return block.invoke(builder);
} finally {
InlineMarker.finallyStart(1);
builder.pop(pushUrlAnnotation);
InlineMarker.finallyEnd(1);
}
}
public static /* synthetic */ AnnotatedString AnnotatedString$default(String str, SpanStyle spanStyle, ParagraphStyle paragraphStyle, int i, Object obj) {
if ((i & 4) != 0) {
paragraphStyle = null;
}
return AnnotatedString(str, spanStyle, paragraphStyle);
}
public static final AnnotatedString AnnotatedString(String text, SpanStyle spanStyle, ParagraphStyle paragraphStyle) {
Intrinsics.checkNotNullParameter(text, "text");
Intrinsics.checkNotNullParameter(spanStyle, "spanStyle");
return new AnnotatedString(text, CollectionsKt.listOf(new AnnotatedString.Range(spanStyle, 0, text.length())), paragraphStyle == null ? CollectionsKt.emptyList() : CollectionsKt.listOf(new AnnotatedString.Range(paragraphStyle, 0, text.length())));
}
public static final AnnotatedString AnnotatedString(String text, ParagraphStyle paragraphStyle) {
Intrinsics.checkNotNullParameter(text, "text");
Intrinsics.checkNotNullParameter(paragraphStyle, "paragraphStyle");
return new AnnotatedString(text, CollectionsKt.emptyList(), CollectionsKt.listOf(new AnnotatedString.Range(paragraphStyle, 0, text.length())));
}
public static final AnnotatedString buildAnnotatedString(Function1<? super AnnotatedString.Builder, Unit> builder) {
Intrinsics.checkNotNullParameter(builder, "builder");
AnnotatedString.Builder builder2 = new AnnotatedString.Builder(0, 1, null);
builder.invoke(builder2);
return builder2.toAnnotatedString();
}
public static final boolean intersect(int i, int i2, int i3, int i4) {
return Math.max(i, i3) < Math.min(i2, i4) || contains(i, i2, i3, i4) || contains(i3, i4, i, i2);
}
public static final <T> List<AnnotatedString.Range<T>> filterRanges(List<? extends AnnotatedString.Range<? extends T>> list, int i, int i2) {
if (i > i2) {
throw new IllegalArgumentException(("start (" + i + ") should be less than or equal to end (" + i2 + ')').toString());
}
if (list == null) {
return null;
}
ArrayList arrayList = new ArrayList(list.size());
int size = list.size();
for (int i3 = 0; i3 < size; i3++) {
AnnotatedString.Range<? extends T> range = list.get(i3);
AnnotatedString.Range<? extends T> range2 = range;
if (intersect(i, i2, range2.getStart(), range2.getEnd())) {
arrayList.add(range);
}
}
ArrayList arrayList2 = arrayList;
ArrayList arrayList3 = new ArrayList(arrayList2.size());
int size2 = arrayList2.size();
for (int i4 = 0; i4 < size2; i4++) {
AnnotatedString.Range range3 = (AnnotatedString.Range) arrayList2.get(i4);
arrayList3.add(new AnnotatedString.Range(range3.getItem(), Math.max(i, range3.getStart()) - i, Math.min(i2, range3.getEnd()) - i, range3.getTag()));
}
ArrayList arrayList4 = arrayList3;
return arrayList4.isEmpty() ? null : arrayList4;
}
}