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

502 lines
37 KiB
Java

package androidx.compose.ui.text;
import androidx.compose.ui.geometry.Offset;
import androidx.compose.ui.geometry.Rect;
import androidx.compose.ui.graphics.AndroidPath_androidKt;
import androidx.compose.ui.graphics.Brush;
import androidx.compose.ui.graphics.Canvas;
import androidx.compose.ui.graphics.Color;
import androidx.compose.ui.graphics.Path;
import androidx.compose.ui.graphics.Shadow;
import androidx.compose.ui.graphics.drawscope.DrawStyle;
import androidx.compose.ui.text.AnnotatedString;
import androidx.compose.ui.text.font.DelegatingFontLoaderForDeprecatedUsage_androidKt;
import androidx.compose.ui.text.font.Font;
import androidx.compose.ui.text.font.FontFamily;
import androidx.compose.ui.text.platform.AndroidMultiParagraphDrawKt;
import androidx.compose.ui.text.style.ResolvedTextDirection;
import androidx.compose.ui.text.style.TextDecoration;
import androidx.compose.ui.unit.Constraints;
import androidx.compose.ui.unit.ConstraintsKt;
import androidx.compose.ui.unit.Density;
import io.sentry.protocol.ViewHierarchyNode;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import kotlin.Deprecated;
import kotlin.DeprecationLevel;
import kotlin.Metadata;
import kotlin.ReplaceWith;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.ranges.RangesKt;
/* compiled from: MultiParagraph.kt */
@Metadata(d1 = {"\u0000Â\u0001\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0007\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0019\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0014\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\b\b\u0007\u0018\u00002\u00020\u0001B+\b\u0017\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\b\b\u0002\u0010\u0004\u001a\u00020\u0005\u0012\b\b\u0002\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\b\u001a\u00020\\u0006\u0002\u0010\nBY\b\u0017\u0012\u0006\u0010\u000b\u001a\u00020\f\u0012\u0006\u0010\r\u001a\u00020\u000e\u0012\u0014\b\u0002\u0010\u000f\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00120\u00110\u0010\u0012\b\b\u0002\u0010\u0004\u001a\u00020\u0005\u0012\b\b\u0002\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\b\u001a\u00020\t\u0012\u0006\u0010\u0013\u001a\u00020\u0014\u0012\u0006\u0010\u0015\u001a\u00020\u0016¢\u0006\u0002\u0010\u0017BY\b\u0017\u0012\u0006\u0010\u000b\u001a\u00020\f\u0012\u0006\u0010\r\u001a\u00020\u000e\u0012\u0006\u0010\b\u001a\u00020\t\u0012\u0006\u0010\u0013\u001a\u00020\u0014\u0012\u0006\u0010\u0018\u001a\u00020\u0019\u0012\u0014\b\u0002\u0010\u000f\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00120\u00110\u0010\u0012\b\b\u0002\u0010\u0004\u001a\u00020\u0005\u0012\b\b\u0002\u0010\u0006\u001a\u00020\u0007¢\u0006\u0002\u0010\u001aB\\\b\u0016\u0012\u0006\u0010\u000b\u001a\u00020\f\u0012\u0006\u0010\r\u001a\u00020\u000e\u0012\u0006\u0010\u001b\u001a\u00020\u001c\u0012\u0006\u0010\u0013\u001a\u00020\u0014\u0012\u0006\u0010\u0018\u001a\u00020\u0019\u0012\u0014\b\u0002\u0010\u000f\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00120\u00110\u0010\u0012\b\b\u0002\u0010\u0004\u001a\u00020\u0005\u0012\b\b\u0002\u0010\u0006\u001a\u00020\u0007ø\u0001\u0000¢\u0006\u0002\u0010\u001dB,\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u001b\u001a\u00020\u001c\u0012\b\b\u0002\u0010\u0004\u001a\u00020\u0005\u0012\b\b\u0002\u0010\u0006\u001a\u00020\u0007ø\u0001\u0000¢\u0006\u0002\u0010\u001eJ\u000e\u0010=\u001a\u00020>2\u0006\u0010?\u001a\u00020\u0005J\u000e\u0010@\u001a\u00020:2\u0006\u0010?\u001a\u00020\u0005J\u000e\u0010A\u001a\u00020:2\u0006\u0010?\u001a\u00020\u0005J\u0016\u0010B\u001a\u00020\t2\u0006\u0010?\u001a\u00020\u00052\u0006\u0010C\u001a\u00020\u0007J\u000e\u0010D\u001a\u00020\t2\u0006\u0010E\u001a\u00020\u0005J\u0018\u0010F\u001a\u00020\u00052\u0006\u0010E\u001a\u00020\u00052\b\b\u0002\u0010G\u001a\u00020\u0007J\u000e\u0010H\u001a\u00020\u00052\u0006\u0010?\u001a\u00020\u0005J\u000e\u0010I\u001a\u00020\u00052\u0006\u0010J\u001a\u00020\tJ\u000e\u0010K\u001a\u00020\t2\u0006\u0010E\u001a\u00020\u0005J\u000e\u0010L\u001a\u00020\t2\u0006\u0010E\u001a\u00020\u0005J\u000e\u0010M\u001a\u00020\t2\u0006\u0010E\u001a\u00020\u0005J\u000e\u0010N\u001a\u00020\u00052\u0006\u0010E\u001a\u00020\u0005J\u000e\u0010O\u001a\u00020\t2\u0006\u0010E\u001a\u00020\u0005J\u000e\u0010P\u001a\u00020\t2\u0006\u0010E\u001a\u00020\u0005J\u001b\u0010Q\u001a\u00020\u00052\u0006\u0010R\u001a\u00020Sø\u0001\u0001ø\u0001\u0000¢\u0006\u0004\bT\u0010UJ\u000e\u0010V\u001a\u00020>2\u0006\u0010?\u001a\u00020\u0005J\u0016\u0010W\u001a\u00020X2\u0006\u0010Y\u001a\u00020\u00052\u0006\u0010Z\u001a\u00020\u0005J\u001e\u0010[\u001a\u00020\\2\u0006\u0010?\u001a\u00020\u0005ø\u0001\u0002ø\u0001\u0001ø\u0001\u0000¢\u0006\u0004\b]\u0010^J\u000e\u0010_\u001a\u00020\u00072\u0006\u0010E\u001a\u00020\u0005J[\u0010`\u001a\u00020a2\u0006\u0010b\u001a\u00020c2\u0006\u0010d\u001a\u00020e2\b\b\u0002\u0010f\u001a\u00020\t2\n\b\u0002\u0010g\u001a\u0004\u0018\u00010h2\n\b\u0002\u0010i\u001a\u0004\u0018\u00010j2\n\b\u0002\u0010k\u001a\u0004\u0018\u00010l2\b\b\u0002\u0010m\u001a\u00020nø\u0001\u0001ø\u0001\u0000¢\u0006\u0004\bo\u0010pJ?\u0010`\u001a\u00020a2\u0006\u0010b\u001a\u00020c2\b\b\u0002\u0010q\u001a\u00020r2\n\b\u0002\u0010g\u001a\u0004\u0018\u00010h2\n\b\u0002\u0010i\u001a\u0004\u0018\u00010jH\u0007ø\u0001\u0001ø\u0001\u0000¢\u0006\u0004\bs\u0010tJS\u0010`\u001a\u00020a2\u0006\u0010b\u001a\u00020c2\b\b\u0002\u0010q\u001a\u00020r2\n\b\u0002\u0010g\u001a\u0004\u0018\u00010h2\n\b\u0002\u0010i\u001a\u0004\u0018\u00010j2\n\b\u0002\u0010k\u001a\u0004\u0018\u00010l2\b\b\u0002\u0010m\u001a\u00020nø\u0001\u0001ø\u0001\u0000¢\u0006\u0004\bu\u0010vJ\u0010\u0010w\u001a\u00020a2\u0006\u0010?\u001a\u00020\u0005H\u0002J\u0010\u0010x\u001a\u00020a2\u0006\u0010?\u001a\u00020\u0005H\u0002J\u0010\u0010y\u001a\u00020a2\u0006\u0010E\u001a\u00020\u0005H\u0002R\u0014\u0010\u000b\u001a\u00020\f8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u001f\u0010 R\u0011\u0010!\u001a\u00020\u0007¢\u0006\b\n\u0000\u001a\u0004\b\"\u0010#R\u0011\u0010$\u001a\u00020\t8F¢\u0006\u0006\u001a\u0004\b%\u0010&R\u0011\u0010'\u001a\u00020\\u0006\b\n\u0000\u001a\u0004\b(\u0010&R\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b)\u0010*R\u0011\u0010+\u001a\u00020\t8F¢\u0006\u0006\u001a\u0004\b,\u0010&R\u0011\u0010-\u001a\u00020\u0005¢\u0006\b\n\u0000\u001a\u0004\b.\u0010/R\u0011\u00100\u001a\u00020\t8F¢\u0006\u0006\u001a\u0004\b1\u0010&R\u0011\u0010\u0004\u001a\u00020\u0005¢\u0006\b\n\u0000\u001a\u0004\b2\u0010/R\u0011\u00103\u001a\u00020\t8F¢\u0006\u0006\u001a\u0004\b4\u0010&R\u001a\u00105\u001a\b\u0012\u0004\u0012\u0002060\u0010X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b7\u00108R\u0019\u00109\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010:0\u0010¢\u0006\b\n\u0000\u001a\u0004\b;\u00108R\u0011\u0010\b\u001a\u00020\\u0006\b\n\u0000\u001a\u0004\b<\u0010&\u0082\u0002\u000f\n\u0002\b\u0019\n\u0005\\u001e0\u0001\n\u0002\b!¨\u0006z"}, d2 = {"Landroidx/compose/ui/text/MultiParagraph;", "", "intrinsics", "Landroidx/compose/ui/text/MultiParagraphIntrinsics;", "maxLines", "", "ellipsis", "", ViewHierarchyNode.JsonKeys.WIDTH, "", "(Landroidx/compose/ui/text/MultiParagraphIntrinsics;IZF)V", "annotatedString", "Landroidx/compose/ui/text/AnnotatedString;", "style", "Landroidx/compose/ui/text/TextStyle;", "placeholders", "", "Landroidx/compose/ui/text/AnnotatedString$Range;", "Landroidx/compose/ui/text/Placeholder;", "density", "Landroidx/compose/ui/unit/Density;", "resourceLoader", "Landroidx/compose/ui/text/font/Font$ResourceLoader;", "(Landroidx/compose/ui/text/AnnotatedString;Landroidx/compose/ui/text/TextStyle;Ljava/util/List;IZFLandroidx/compose/ui/unit/Density;Landroidx/compose/ui/text/font/Font$ResourceLoader;)V", "fontFamilyResolver", "Landroidx/compose/ui/text/font/FontFamily$Resolver;", "(Landroidx/compose/ui/text/AnnotatedString;Landroidx/compose/ui/text/TextStyle;FLandroidx/compose/ui/unit/Density;Landroidx/compose/ui/text/font/FontFamily$Resolver;Ljava/util/List;IZ)V", "constraints", "Landroidx/compose/ui/unit/Constraints;", "(Landroidx/compose/ui/text/AnnotatedString;Landroidx/compose/ui/text/TextStyle;JLandroidx/compose/ui/unit/Density;Landroidx/compose/ui/text/font/FontFamily$Resolver;Ljava/util/List;IZLkotlin/jvm/internal/DefaultConstructorMarker;)V", "(Landroidx/compose/ui/text/MultiParagraphIntrinsics;JIZLkotlin/jvm/internal/DefaultConstructorMarker;)V", "getAnnotatedString", "()Landroidx/compose/ui/text/AnnotatedString;", "didExceedMaxLines", "getDidExceedMaxLines", "()Z", "firstBaseline", "getFirstBaseline", "()F", ViewHierarchyNode.JsonKeys.HEIGHT, "getHeight", "getIntrinsics", "()Landroidx/compose/ui/text/MultiParagraphIntrinsics;", "lastBaseline", "getLastBaseline", "lineCount", "getLineCount", "()I", "maxIntrinsicWidth", "getMaxIntrinsicWidth", "getMaxLines", "minIntrinsicWidth", "getMinIntrinsicWidth", "paragraphInfoList", "Landroidx/compose/ui/text/ParagraphInfo;", "getParagraphInfoList$ui_text_release", "()Ljava/util/List;", "placeholderRects", "Landroidx/compose/ui/geometry/Rect;", "getPlaceholderRects", "getWidth", "getBidiRunDirection", "Landroidx/compose/ui/text/style/ResolvedTextDirection;", "offset", "getBoundingBox", "getCursorRect", "getHorizontalPosition", "usePrimaryDirection", "getLineBottom", "lineIndex", "getLineEnd", "visibleEnd", "getLineForOffset", "getLineForVerticalPosition", "vertical", "getLineHeight", "getLineLeft", "getLineRight", "getLineStart", "getLineTop", "getLineWidth", "getOffsetForPosition", "position", "Landroidx/compose/ui/geometry/Offset;", "getOffsetForPosition-k-4lQ0M", "(J)I", "getParagraphDirection", "getPathForRange", "Landroidx/compose/ui/graphics/Path;", "start", "end", "getWordBoundary", "Landroidx/compose/ui/text/TextRange;", "getWordBoundary--jx7JFs", "(I)J", "isLineEllipsized", "paint", "", "canvas", "Landroidx/compose/ui/graphics/Canvas;", "brush", "Landroidx/compose/ui/graphics/Brush;", ViewHierarchyNode.JsonKeys.ALPHA, "shadow", "Landroidx/compose/ui/graphics/Shadow;", "decoration", "Landroidx/compose/ui/text/style/TextDecoration;", "drawStyle", "Landroidx/compose/ui/graphics/drawscope/DrawStyle;", "blendMode", "Landroidx/compose/ui/graphics/BlendMode;", "paint-hn5TExg", "(Landroidx/compose/ui/graphics/Canvas;Landroidx/compose/ui/graphics/Brush;FLandroidx/compose/ui/graphics/Shadow;Landroidx/compose/ui/text/style/TextDecoration;Landroidx/compose/ui/graphics/drawscope/DrawStyle;I)V", "color", "Landroidx/compose/ui/graphics/Color;", "paint-RPmYEkk", "(Landroidx/compose/ui/graphics/Canvas;JLandroidx/compose/ui/graphics/Shadow;Landroidx/compose/ui/text/style/TextDecoration;)V", "paint-LG529CI", "(Landroidx/compose/ui/graphics/Canvas;JLandroidx/compose/ui/graphics/Shadow;Landroidx/compose/ui/text/style/TextDecoration;Landroidx/compose/ui/graphics/drawscope/DrawStyle;I)V", "requireIndexInRange", "requireIndexInRangeInclusiveEnd", "requireLineIndexInRange", "ui-text_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class MultiParagraph {
public static final int $stable = 8;
private final boolean didExceedMaxLines;
private final float height;
private final MultiParagraphIntrinsics intrinsics;
private final int lineCount;
private final int maxLines;
private final List<ParagraphInfo> paragraphInfoList;
private final List<Rect> placeholderRects;
private final float width;
public /* synthetic */ MultiParagraph(AnnotatedString annotatedString, TextStyle textStyle, long j, Density density, FontFamily.Resolver resolver, List list, int i, boolean z, DefaultConstructorMarker defaultConstructorMarker) {
this(annotatedString, textStyle, j, density, resolver, (List<AnnotatedString.Range<Placeholder>>) list, i, z);
}
public /* synthetic */ MultiParagraph(MultiParagraphIntrinsics multiParagraphIntrinsics, long j, int i, boolean z, DefaultConstructorMarker defaultConstructorMarker) {
this(multiParagraphIntrinsics, j, i, z);
}
public final boolean getDidExceedMaxLines() {
return this.didExceedMaxLines;
}
public final float getHeight() {
return this.height;
}
public final MultiParagraphIntrinsics getIntrinsics() {
return this.intrinsics;
}
public final int getLineCount() {
return this.lineCount;
}
public final int getMaxLines() {
return this.maxLines;
}
public final List<ParagraphInfo> getParagraphInfoList$ui_text_release() {
return this.paragraphInfoList;
}
public final List<Rect> getPlaceholderRects() {
return this.placeholderRects;
}
public final float getWidth() {
return this.width;
}
private MultiParagraph(MultiParagraphIntrinsics intrinsics, long j, int i, boolean z) {
boolean z2;
int m4838getMaxHeightimpl;
Intrinsics.checkNotNullParameter(intrinsics, "intrinsics");
this.intrinsics = intrinsics;
this.maxLines = i;
if (Constraints.m4841getMinWidthimpl(j) != 0 || Constraints.m4840getMinHeightimpl(j) != 0) {
throw new IllegalArgumentException("Setting Constraints.minWidth and Constraints.minHeight is not supported, these should be the default zero values instead.".toString());
}
ArrayList arrayList = new ArrayList();
List<ParagraphIntrinsicInfo> infoList$ui_text_release = intrinsics.getInfoList$ui_text_release();
int size = infoList$ui_text_release.size();
int i2 = 0;
int i3 = 0;
float f = 0.0f;
int i4 = 0;
while (i4 < size) {
ParagraphIntrinsicInfo paragraphIntrinsicInfo = infoList$ui_text_release.get(i4);
ParagraphIntrinsics intrinsics2 = paragraphIntrinsicInfo.getIntrinsics();
int m4839getMaxWidthimpl = Constraints.m4839getMaxWidthimpl(j);
if (Constraints.m4834getHasBoundedHeightimpl(j)) {
m4838getMaxHeightimpl = RangesKt.coerceAtLeast(Constraints.m4838getMaxHeightimpl(j) - ParagraphKt.ceilToInt(f), i2);
} else {
m4838getMaxHeightimpl = Constraints.m4838getMaxHeightimpl(j);
}
Paragraph m4314Paragraph_EkL_Y = ParagraphKt.m4314Paragraph_EkL_Y(intrinsics2, ConstraintsKt.Constraints$default(0, m4839getMaxWidthimpl, 0, m4838getMaxHeightimpl, 5, null), this.maxLines - i3, z);
float height = f + m4314Paragraph_EkL_Y.getHeight();
int lineCount = i3 + m4314Paragraph_EkL_Y.getLineCount();
List<ParagraphIntrinsicInfo> list = infoList$ui_text_release;
arrayList.add(new ParagraphInfo(m4314Paragraph_EkL_Y, paragraphIntrinsicInfo.getStartIndex(), paragraphIntrinsicInfo.getEndIndex(), i3, lineCount, f, height));
if (m4314Paragraph_EkL_Y.getDidExceedMaxLines() || (lineCount == this.maxLines && i4 != CollectionsKt.getLastIndex(this.intrinsics.getInfoList$ui_text_release()))) {
z2 = true;
i3 = lineCount;
f = height;
break;
} else {
i4++;
i3 = lineCount;
f = height;
i2 = 0;
infoList$ui_text_release = list;
}
}
z2 = false;
this.height = f;
this.lineCount = i3;
this.didExceedMaxLines = z2;
this.paragraphInfoList = arrayList;
this.width = Constraints.m4839getMaxWidthimpl(j);
ArrayList arrayList2 = new ArrayList(arrayList.size());
int size2 = arrayList.size();
for (int i5 = 0; i5 < size2; i5++) {
ParagraphInfo paragraphInfo = (ParagraphInfo) arrayList.get(i5);
List<Rect> placeholderRects = paragraphInfo.getParagraph().getPlaceholderRects();
ArrayList arrayList3 = new ArrayList(placeholderRects.size());
int size3 = placeholderRects.size();
for (int i6 = 0; i6 < size3; i6++) {
ArrayList arrayList4 = arrayList3;
Rect rect = placeholderRects.get(i6);
arrayList4.add(rect != null ? paragraphInfo.toGlobal(rect) : null);
}
CollectionsKt.addAll(arrayList2, arrayList3);
}
ArrayList arrayList5 = arrayList2;
if (arrayList5.size() < this.intrinsics.getPlaceholders().size()) {
ArrayList arrayList6 = arrayList5;
int size4 = this.intrinsics.getPlaceholders().size() - arrayList5.size();
ArrayList arrayList7 = new ArrayList(size4);
for (int i7 = 0; i7 < size4; i7++) {
arrayList7.add(null);
}
arrayList5 = CollectionsKt.plus((Collection) arrayList6, (Iterable) arrayList7);
}
this.placeholderRects = arrayList5;
}
public /* synthetic */ MultiParagraph(MultiParagraphIntrinsics multiParagraphIntrinsics, long j, int i, boolean z, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this(multiParagraphIntrinsics, j, (i2 & 4) != 0 ? Integer.MAX_VALUE : i, (i2 & 8) != 0 ? false : z, null);
}
public /* synthetic */ MultiParagraph(MultiParagraphIntrinsics multiParagraphIntrinsics, int i, boolean z, float f, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this(multiParagraphIntrinsics, (i2 & 2) != 0 ? Integer.MAX_VALUE : i, (i2 & 4) != 0 ? false : z, f);
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
@Deprecated(message = "MultiParagraph that takes maximum allowed width is deprecated, pass constraints instead.", replaceWith = @ReplaceWith(expression = "MultiParagraph(intrinsics, Constraints(maxWidth = ceil(width).toInt()), maxLines, ellipsis)", imports = {"kotlin.math.ceil", "androidx.compose.ui.unit.Constraints"}))
public MultiParagraph(MultiParagraphIntrinsics intrinsics, int i, boolean z, float f) {
this(intrinsics, ConstraintsKt.Constraints$default(0, ParagraphKt.ceilToInt(f), 0, 0, 13, null), i, z, null);
Intrinsics.checkNotNullParameter(intrinsics, "intrinsics");
}
public /* synthetic */ MultiParagraph(AnnotatedString annotatedString, TextStyle textStyle, List list, int i, boolean z, float f, Density density, Font.ResourceLoader resourceLoader, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this(annotatedString, textStyle, (List<AnnotatedString.Range<Placeholder>>) ((i2 & 4) != 0 ? CollectionsKt.emptyList() : list), (i2 & 8) != 0 ? Integer.MAX_VALUE : i, (i2 & 16) != 0 ? false : z, f, density, resourceLoader);
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
@Deprecated(message = "Font.ResourceLoader is deprecated, use fontFamilyResolver instead", replaceWith = @ReplaceWith(expression = "MultiParagraph(annotatedString, style, placeholders, maxLines, ellipsis, width, density, fontFamilyResolver)", imports = {}))
public MultiParagraph(AnnotatedString annotatedString, TextStyle style, List<AnnotatedString.Range<Placeholder>> placeholders, int i, boolean z, float f, Density density, Font.ResourceLoader resourceLoader) {
this(new MultiParagraphIntrinsics(annotatedString, style, placeholders, density, DelegatingFontLoaderForDeprecatedUsage_androidKt.createFontFamilyResolver(resourceLoader)), ConstraintsKt.Constraints$default(0, ParagraphKt.ceilToInt(f), 0, 0, 13, null), i, z, null);
Intrinsics.checkNotNullParameter(annotatedString, "annotatedString");
Intrinsics.checkNotNullParameter(style, "style");
Intrinsics.checkNotNullParameter(placeholders, "placeholders");
Intrinsics.checkNotNullParameter(density, "density");
Intrinsics.checkNotNullParameter(resourceLoader, "resourceLoader");
}
public /* synthetic */ MultiParagraph(AnnotatedString annotatedString, TextStyle textStyle, float f, Density density, FontFamily.Resolver resolver, List list, int i, boolean z, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this(annotatedString, textStyle, f, density, resolver, (List<AnnotatedString.Range<Placeholder>>) ((i2 & 32) != 0 ? CollectionsKt.emptyList() : list), (i2 & 64) != 0 ? Integer.MAX_VALUE : i, (i2 & 128) != 0 ? false : z);
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
@Deprecated(message = "MultiParagraph that takes maximum allowed width is deprecated, pass constraints instead.", replaceWith = @ReplaceWith(expression = "MultiParagraph(annotatedString, style, Constraints(maxWidth = ceil(width).toInt()), density, fontFamilyResolver, placeholders, maxLines, ellipsis)", imports = {"kotlin.math.ceil", "androidx.compose.ui.unit.Constraints"}))
public MultiParagraph(AnnotatedString annotatedString, TextStyle style, float f, Density density, FontFamily.Resolver fontFamilyResolver, List<AnnotatedString.Range<Placeholder>> placeholders, int i, boolean z) {
this(new MultiParagraphIntrinsics(annotatedString, style, placeholders, density, fontFamilyResolver), ConstraintsKt.Constraints$default(0, ParagraphKt.ceilToInt(f), 0, 0, 13, null), i, z, null);
Intrinsics.checkNotNullParameter(annotatedString, "annotatedString");
Intrinsics.checkNotNullParameter(style, "style");
Intrinsics.checkNotNullParameter(density, "density");
Intrinsics.checkNotNullParameter(fontFamilyResolver, "fontFamilyResolver");
Intrinsics.checkNotNullParameter(placeholders, "placeholders");
}
public /* synthetic */ MultiParagraph(AnnotatedString annotatedString, TextStyle textStyle, long j, Density density, FontFamily.Resolver resolver, List list, int i, boolean z, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this(annotatedString, textStyle, j, density, resolver, (i2 & 32) != 0 ? CollectionsKt.emptyList() : list, (i2 & 64) != 0 ? Integer.MAX_VALUE : i, (i2 & 128) != 0 ? false : z, null);
}
/* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
private MultiParagraph(AnnotatedString annotatedString, TextStyle style, long j, Density density, FontFamily.Resolver fontFamilyResolver, List<AnnotatedString.Range<Placeholder>> placeholders, int i, boolean z) {
this(new MultiParagraphIntrinsics(annotatedString, style, placeholders, density, fontFamilyResolver), j, i, z, null);
Intrinsics.checkNotNullParameter(annotatedString, "annotatedString");
Intrinsics.checkNotNullParameter(style, "style");
Intrinsics.checkNotNullParameter(density, "density");
Intrinsics.checkNotNullParameter(fontFamilyResolver, "fontFamilyResolver");
Intrinsics.checkNotNullParameter(placeholders, "placeholders");
}
private final AnnotatedString getAnnotatedString() {
return this.intrinsics.getAnnotatedString();
}
public final float getMinIntrinsicWidth() {
return this.intrinsics.getMinIntrinsicWidth();
}
public final float getMaxIntrinsicWidth() {
return this.intrinsics.getMaxIntrinsicWidth();
}
public final float getFirstBaseline() {
if (this.paragraphInfoList.isEmpty()) {
return 0.0f;
}
return this.paragraphInfoList.get(0).getParagraph().getFirstBaseline();
}
public final float getLastBaseline() {
if (this.paragraphInfoList.isEmpty()) {
return 0.0f;
}
ParagraphInfo paragraphInfo = (ParagraphInfo) CollectionsKt.last((List) this.paragraphInfoList);
return paragraphInfo.toGlobalYPosition(paragraphInfo.getParagraph().getLastBaseline());
}
/* renamed from: paint-RPmYEkk$default, reason: not valid java name */
public static /* synthetic */ void m4300paintRPmYEkk$default(MultiParagraph multiParagraph, Canvas canvas, long j, Shadow shadow, TextDecoration textDecoration, int i, Object obj) {
if ((i & 2) != 0) {
j = Color.INSTANCE.m2675getUnspecified0d7_KjU();
}
multiParagraph.m4305paintRPmYEkk(canvas, j, (i & 4) != 0 ? null : shadow, (i & 8) != 0 ? null : textDecoration);
}
@Deprecated(level = DeprecationLevel.HIDDEN, message = "Use the new paint function that takes canvas as the only required parameter.")
/* renamed from: paint-RPmYEkk, reason: not valid java name */
public final /* synthetic */ void m4305paintRPmYEkk(Canvas canvas, long color, Shadow shadow, TextDecoration decoration) {
Intrinsics.checkNotNullParameter(canvas, "canvas");
canvas.save();
List<ParagraphInfo> list = this.paragraphInfoList;
int size = list.size();
for (int i = 0; i < size; i++) {
ParagraphInfo paragraphInfo = list.get(i);
paragraphInfo.getParagraph().mo4277paintRPmYEkk(canvas, color, shadow, decoration);
canvas.translate(0.0f, paragraphInfo.getParagraph().getHeight());
}
canvas.restore();
}
/* renamed from: paint-LG529CI, reason: not valid java name */
public final void m4304paintLG529CI(Canvas canvas, long color, Shadow shadow, TextDecoration decoration, DrawStyle drawStyle, int blendMode) {
Intrinsics.checkNotNullParameter(canvas, "canvas");
canvas.save();
List<ParagraphInfo> list = this.paragraphInfoList;
int size = list.size();
for (int i = 0; i < size; i++) {
ParagraphInfo paragraphInfo = list.get(i);
paragraphInfo.getParagraph().mo4276paintLG529CI(canvas, color, shadow, decoration, drawStyle, blendMode);
canvas.translate(0.0f, paragraphInfo.getParagraph().getHeight());
}
canvas.restore();
}
/* renamed from: paint-hn5TExg, reason: not valid java name */
public final void m4306painthn5TExg(Canvas canvas, Brush brush, float alpha, Shadow shadow, TextDecoration decoration, DrawStyle drawStyle, int blendMode) {
Intrinsics.checkNotNullParameter(canvas, "canvas");
Intrinsics.checkNotNullParameter(brush, "brush");
AndroidMultiParagraphDrawKt.m4638drawMultiParagraph7AXcY_I(this, canvas, brush, alpha, shadow, decoration, drawStyle, blendMode);
}
public final Path getPathForRange(int start, int end) {
if (start < 0 || start > end || end > getAnnotatedString().getText().length()) {
throw new IllegalArgumentException(("Start(" + start + ") or End(" + end + ") is out of range [0.." + getAnnotatedString().getText().length() + "), or start > end!").toString());
}
if (start == end) {
return AndroidPath_androidKt.Path();
}
Path Path = AndroidPath_androidKt.Path();
int size = this.paragraphInfoList.size();
for (int findParagraphByIndex = MultiParagraphKt.findParagraphByIndex(this.paragraphInfoList, start); findParagraphByIndex < size; findParagraphByIndex++) {
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(findParagraphByIndex);
if (paragraphInfo.getStartIndex() >= end) {
break;
}
if (paragraphInfo.getStartIndex() != paragraphInfo.getEndIndex()) {
Path.m2903addPathUv8p0NA$default(Path, paragraphInfo.toGlobal(paragraphInfo.getParagraph().getPathForRange(paragraphInfo.toLocalIndex(start), paragraphInfo.toLocalIndex(end))), 0L, 2, null);
}
}
return Path;
}
public final int getLineForVerticalPosition(float vertical) {
int findParagraphByY;
if (vertical <= 0.0f) {
findParagraphByY = 0;
} else if (vertical >= this.height) {
findParagraphByY = CollectionsKt.getLastIndex(this.paragraphInfoList);
} else {
findParagraphByY = MultiParagraphKt.findParagraphByY(this.paragraphInfoList, vertical);
}
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(findParagraphByY);
if (paragraphInfo.getLength() == 0) {
return Math.max(0, paragraphInfo.getStartIndex() - 1);
}
return paragraphInfo.toGlobalLineIndex(paragraphInfo.getParagraph().getLineForVerticalPosition(paragraphInfo.toLocalYPosition(vertical)));
}
/* renamed from: getOffsetForPosition-k-4lQ0M, reason: not valid java name */
public final int m4302getOffsetForPositionk4lQ0M(long position) {
int lastIndex;
if (Offset.m2401getYimpl(position) <= 0.0f) {
lastIndex = 0;
} else {
lastIndex = Offset.m2401getYimpl(position) >= this.height ? CollectionsKt.getLastIndex(this.paragraphInfoList) : MultiParagraphKt.findParagraphByY(this.paragraphInfoList, Offset.m2401getYimpl(position));
}
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(lastIndex);
if (paragraphInfo.getLength() == 0) {
return Math.max(0, paragraphInfo.getStartIndex() - 1);
}
return paragraphInfo.toGlobalIndex(paragraphInfo.getParagraph().mo4274getOffsetForPositionk4lQ0M(paragraphInfo.m4311toLocalMKHz9U(position)));
}
public final Rect getBoundingBox(int offset) {
requireIndexInRange(offset);
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(MultiParagraphKt.findParagraphByIndex(this.paragraphInfoList, offset));
return paragraphInfo.toGlobal(paragraphInfo.getParagraph().getBoundingBox(paragraphInfo.toLocalIndex(offset)));
}
public final float getHorizontalPosition(int offset, boolean usePrimaryDirection) {
int findParagraphByIndex;
requireIndexInRangeInclusiveEnd(offset);
if (offset == getAnnotatedString().length()) {
findParagraphByIndex = CollectionsKt.getLastIndex(this.paragraphInfoList);
} else {
findParagraphByIndex = MultiParagraphKt.findParagraphByIndex(this.paragraphInfoList, offset);
}
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(findParagraphByIndex);
return paragraphInfo.getParagraph().getHorizontalPosition(paragraphInfo.toLocalIndex(offset), usePrimaryDirection);
}
public final ResolvedTextDirection getParagraphDirection(int offset) {
int findParagraphByIndex;
requireIndexInRangeInclusiveEnd(offset);
if (offset == getAnnotatedString().length()) {
findParagraphByIndex = CollectionsKt.getLastIndex(this.paragraphInfoList);
} else {
findParagraphByIndex = MultiParagraphKt.findParagraphByIndex(this.paragraphInfoList, offset);
}
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(findParagraphByIndex);
return paragraphInfo.getParagraph().getParagraphDirection(paragraphInfo.toLocalIndex(offset));
}
public final ResolvedTextDirection getBidiRunDirection(int offset) {
int findParagraphByIndex;
requireIndexInRangeInclusiveEnd(offset);
if (offset == getAnnotatedString().length()) {
findParagraphByIndex = CollectionsKt.getLastIndex(this.paragraphInfoList);
} else {
findParagraphByIndex = MultiParagraphKt.findParagraphByIndex(this.paragraphInfoList, offset);
}
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(findParagraphByIndex);
return paragraphInfo.getParagraph().getBidiRunDirection(paragraphInfo.toLocalIndex(offset));
}
/* renamed from: getWordBoundary--jx7JFs, reason: not valid java name */
public final long m4303getWordBoundaryjx7JFs(int offset) {
int findParagraphByIndex;
requireIndexInRangeInclusiveEnd(offset);
if (offset == getAnnotatedString().length()) {
findParagraphByIndex = CollectionsKt.getLastIndex(this.paragraphInfoList);
} else {
findParagraphByIndex = MultiParagraphKt.findParagraphByIndex(this.paragraphInfoList, offset);
}
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(findParagraphByIndex);
return paragraphInfo.m4310toGlobalGEjPoXI(paragraphInfo.getParagraph().mo4275getWordBoundaryjx7JFs(paragraphInfo.toLocalIndex(offset)));
}
public final Rect getCursorRect(int offset) {
int findParagraphByIndex;
requireIndexInRangeInclusiveEnd(offset);
if (offset == getAnnotatedString().length()) {
findParagraphByIndex = CollectionsKt.getLastIndex(this.paragraphInfoList);
} else {
findParagraphByIndex = MultiParagraphKt.findParagraphByIndex(this.paragraphInfoList, offset);
}
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(findParagraphByIndex);
return paragraphInfo.toGlobal(paragraphInfo.getParagraph().getCursorRect(paragraphInfo.toLocalIndex(offset)));
}
public final int getLineForOffset(int offset) {
int findParagraphByIndex;
if (offset >= getAnnotatedString().length()) {
findParagraphByIndex = CollectionsKt.getLastIndex(this.paragraphInfoList);
} else {
findParagraphByIndex = offset < 0 ? 0 : MultiParagraphKt.findParagraphByIndex(this.paragraphInfoList, offset);
}
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(findParagraphByIndex);
return paragraphInfo.toGlobalLineIndex(paragraphInfo.getParagraph().getLineForOffset(paragraphInfo.toLocalIndex(offset)));
}
public final float getLineLeft(int lineIndex) {
requireLineIndexInRange(lineIndex);
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(MultiParagraphKt.findParagraphByLineIndex(this.paragraphInfoList, lineIndex));
return paragraphInfo.getParagraph().getLineLeft(paragraphInfo.toLocalLineIndex(lineIndex));
}
public final float getLineRight(int lineIndex) {
requireLineIndexInRange(lineIndex);
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(MultiParagraphKt.findParagraphByLineIndex(this.paragraphInfoList, lineIndex));
return paragraphInfo.getParagraph().getLineRight(paragraphInfo.toLocalLineIndex(lineIndex));
}
public final float getLineTop(int lineIndex) {
requireLineIndexInRange(lineIndex);
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(MultiParagraphKt.findParagraphByLineIndex(this.paragraphInfoList, lineIndex));
return paragraphInfo.toGlobalYPosition(paragraphInfo.getParagraph().getLineTop(paragraphInfo.toLocalLineIndex(lineIndex)));
}
public final float getLineBottom(int lineIndex) {
requireLineIndexInRange(lineIndex);
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(MultiParagraphKt.findParagraphByLineIndex(this.paragraphInfoList, lineIndex));
return paragraphInfo.toGlobalYPosition(paragraphInfo.getParagraph().getLineBottom(paragraphInfo.toLocalLineIndex(lineIndex)));
}
public final float getLineHeight(int lineIndex) {
requireLineIndexInRange(lineIndex);
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(MultiParagraphKt.findParagraphByLineIndex(this.paragraphInfoList, lineIndex));
return paragraphInfo.getParagraph().getLineHeight(paragraphInfo.toLocalLineIndex(lineIndex));
}
public final float getLineWidth(int lineIndex) {
requireLineIndexInRange(lineIndex);
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(MultiParagraphKt.findParagraphByLineIndex(this.paragraphInfoList, lineIndex));
return paragraphInfo.getParagraph().getLineWidth(paragraphInfo.toLocalLineIndex(lineIndex));
}
public final int getLineStart(int lineIndex) {
requireLineIndexInRange(lineIndex);
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(MultiParagraphKt.findParagraphByLineIndex(this.paragraphInfoList, lineIndex));
return paragraphInfo.toGlobalIndex(paragraphInfo.getParagraph().getLineStart(paragraphInfo.toLocalLineIndex(lineIndex)));
}
public static /* synthetic */ int getLineEnd$default(MultiParagraph multiParagraph, int i, boolean z, int i2, Object obj) {
if ((i2 & 2) != 0) {
z = false;
}
return multiParagraph.getLineEnd(i, z);
}
public final int getLineEnd(int lineIndex, boolean visibleEnd) {
requireLineIndexInRange(lineIndex);
ParagraphInfo paragraphInfo = this.paragraphInfoList.get(MultiParagraphKt.findParagraphByLineIndex(this.paragraphInfoList, lineIndex));
return paragraphInfo.toGlobalIndex(paragraphInfo.getParagraph().getLineEnd(paragraphInfo.toLocalLineIndex(lineIndex), visibleEnd));
}
public final boolean isLineEllipsized(int lineIndex) {
requireLineIndexInRange(lineIndex);
return this.paragraphInfoList.get(MultiParagraphKt.findParagraphByLineIndex(this.paragraphInfoList, lineIndex)).getParagraph().isLineEllipsized(lineIndex);
}
private final void requireIndexInRange(int offset) {
if (offset < 0 || offset >= getAnnotatedString().getText().length()) {
throw new IllegalArgumentException(("offset(" + offset + ") is out of bounds [0, " + getAnnotatedString().length() + ')').toString());
}
}
private final void requireIndexInRangeInclusiveEnd(int offset) {
if (offset < 0 || offset > getAnnotatedString().getText().length()) {
throw new IllegalArgumentException(("offset(" + offset + ") is out of bounds [0, " + getAnnotatedString().length() + ']').toString());
}
}
private final void requireLineIndexInRange(int lineIndex) {
if (lineIndex < 0 || lineIndex >= this.lineCount) {
throw new IllegalArgumentException(("lineIndex(" + lineIndex + ") is out of bounds [0, " + this.lineCount + ')').toString());
}
}
}