package androidx.compose.ui.text; 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.style.TextDirection; import androidx.compose.ui.unit.Density; import java.util.ArrayList; import java.util.List; import kotlin.Deprecated; import kotlin.Lazy; import kotlin.LazyKt; import kotlin.LazyThreadSafetyMode; import kotlin.Metadata; import kotlin.ReplaceWith; import kotlin.collections.CollectionsKt; import kotlin.jvm.functions.Function0; import kotlin.jvm.internal.Intrinsics; /* compiled from: MultiParagraphIntrinsics.kt */ @Metadata(d1 = {"\u0000Z\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\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\u0004\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u0007\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\u0002\b\u0007\u0018\u00002\u00020\u0001B;\b\u0017\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0012\u0010\u0006\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\t0\b0\u0007\u0012\u0006\u0010\n\u001a\u00020\u000b\u0012\u0006\u0010\f\u001a\u00020\r¢\u0006\u0002\u0010\u000eB9\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0012\u0010\u0006\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\t0\b0\u0007\u0012\u0006\u0010\n\u001a\u00020\u000b\u0012\u0006\u0010\u000f\u001a\u00020\u0010¢\u0006\u0002\u0010\u0011J\u0018\u0010&\u001a\u00020'2\u0006\u0010\u0004\u001a\u00020'2\u0006\u0010(\u001a\u00020'H\u0002R\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0012\u0010\u0013R\u0014\u0010\u0014\u001a\u00020\u00158VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0016\u0010\u0017R\u001a\u0010\u0018\u001a\b\u0012\u0004\u0012\u00020\u00190\u0007X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u001a\u0010\u001bR\u001b\u0010\u001c\u001a\u00020\u001d8VX\u0096\u0084\u0002¢\u0006\f\n\u0004\b \u0010!\u001a\u0004\b\u001e\u0010\u001fR\u001b\u0010\"\u001a\u00020\u001d8VX\u0096\u0084\u0002¢\u0006\f\n\u0004\b$\u0010!\u001a\u0004\b#\u0010\u001fR\u001d\u0010\u0006\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\t0\b0\u0007¢\u0006\b\n\u0000\u001a\u0004\b%\u0010\u001b¨\u0006)"}, d2 = {"Landroidx/compose/ui/text/MultiParagraphIntrinsics;", "Landroidx/compose/ui/text/ParagraphIntrinsics;", "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;Landroidx/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;Ljava/util/List;Landroidx/compose/ui/unit/Density;Landroidx/compose/ui/text/font/FontFamily$Resolver;)V", "getAnnotatedString", "()Landroidx/compose/ui/text/AnnotatedString;", "hasStaleResolvedFonts", "", "getHasStaleResolvedFonts", "()Z", "infoList", "Landroidx/compose/ui/text/ParagraphIntrinsicInfo;", "getInfoList$ui_text_release", "()Ljava/util/List;", "maxIntrinsicWidth", "", "getMaxIntrinsicWidth", "()F", "maxIntrinsicWidth$delegate", "Lkotlin/Lazy;", "minIntrinsicWidth", "getMinIntrinsicWidth", "minIntrinsicWidth$delegate", "getPlaceholders", "resolveTextDirection", "Landroidx/compose/ui/text/ParagraphStyle;", "defaultStyle", "ui-text_release"}, k = 1, mv = {1, 8, 0}, xi = 48) /* loaded from: classes.dex */ public final class MultiParagraphIntrinsics implements ParagraphIntrinsics { public static final int $stable = 8; private final AnnotatedString annotatedString; private final List infoList; /* renamed from: maxIntrinsicWidth$delegate, reason: from kotlin metadata */ private final Lazy maxIntrinsicWidth; /* renamed from: minIntrinsicWidth$delegate, reason: from kotlin metadata */ private final Lazy minIntrinsicWidth; private final List> placeholders; public final AnnotatedString getAnnotatedString() { return this.annotatedString; } public final List getInfoList$ui_text_release() { return this.infoList; } public final List> getPlaceholders() { return this.placeholders; } public MultiParagraphIntrinsics(AnnotatedString annotatedString, TextStyle textStyle, List> placeholders, Density density, FontFamily.Resolver fontFamilyResolver) { List localPlaceholders; AnnotatedString annotatedString2 = annotatedString; TextStyle style = textStyle; Intrinsics.checkNotNullParameter(annotatedString2, "annotatedString"); Intrinsics.checkNotNullParameter(style, "style"); Intrinsics.checkNotNullParameter(placeholders, "placeholders"); Intrinsics.checkNotNullParameter(density, "density"); Intrinsics.checkNotNullParameter(fontFamilyResolver, "fontFamilyResolver"); this.annotatedString = annotatedString2; this.placeholders = placeholders; this.minIntrinsicWidth = LazyKt.lazy(LazyThreadSafetyMode.NONE, (Function0) new Function0() { // from class: androidx.compose.ui.text.MultiParagraphIntrinsics$minIntrinsicWidth$2 /* JADX INFO: Access modifiers changed from: package-private */ { super(0); } /* JADX WARN: Can't rename method to resolve collision */ @Override // kotlin.jvm.functions.Function0 public final Float invoke() { ParagraphIntrinsicInfo paragraphIntrinsicInfo; ParagraphIntrinsics intrinsics; List infoList$ui_text_release = MultiParagraphIntrinsics.this.getInfoList$ui_text_release(); if (infoList$ui_text_release.isEmpty()) { paragraphIntrinsicInfo = null; } else { ParagraphIntrinsicInfo paragraphIntrinsicInfo2 = infoList$ui_text_release.get(0); float minIntrinsicWidth = paragraphIntrinsicInfo2.getIntrinsics().getMinIntrinsicWidth(); int lastIndex = CollectionsKt.getLastIndex(infoList$ui_text_release); int i = 1; if (1 <= lastIndex) { while (true) { ParagraphIntrinsicInfo paragraphIntrinsicInfo3 = infoList$ui_text_release.get(i); float minIntrinsicWidth2 = paragraphIntrinsicInfo3.getIntrinsics().getMinIntrinsicWidth(); if (Float.compare(minIntrinsicWidth, minIntrinsicWidth2) < 0) { paragraphIntrinsicInfo2 = paragraphIntrinsicInfo3; minIntrinsicWidth = minIntrinsicWidth2; } if (i == lastIndex) { break; } i++; } } paragraphIntrinsicInfo = paragraphIntrinsicInfo2; } ParagraphIntrinsicInfo paragraphIntrinsicInfo4 = paragraphIntrinsicInfo; return Float.valueOf((paragraphIntrinsicInfo4 == null || (intrinsics = paragraphIntrinsicInfo4.getIntrinsics()) == null) ? 0.0f : intrinsics.getMinIntrinsicWidth()); } }); this.maxIntrinsicWidth = LazyKt.lazy(LazyThreadSafetyMode.NONE, (Function0) new Function0() { // from class: androidx.compose.ui.text.MultiParagraphIntrinsics$maxIntrinsicWidth$2 /* JADX INFO: Access modifiers changed from: package-private */ { super(0); } /* JADX WARN: Can't rename method to resolve collision */ @Override // kotlin.jvm.functions.Function0 public final Float invoke() { ParagraphIntrinsicInfo paragraphIntrinsicInfo; ParagraphIntrinsics intrinsics; List infoList$ui_text_release = MultiParagraphIntrinsics.this.getInfoList$ui_text_release(); if (infoList$ui_text_release.isEmpty()) { paragraphIntrinsicInfo = null; } else { ParagraphIntrinsicInfo paragraphIntrinsicInfo2 = infoList$ui_text_release.get(0); float maxIntrinsicWidth = paragraphIntrinsicInfo2.getIntrinsics().getMaxIntrinsicWidth(); int lastIndex = CollectionsKt.getLastIndex(infoList$ui_text_release); int i = 1; if (1 <= lastIndex) { while (true) { ParagraphIntrinsicInfo paragraphIntrinsicInfo3 = infoList$ui_text_release.get(i); float maxIntrinsicWidth2 = paragraphIntrinsicInfo3.getIntrinsics().getMaxIntrinsicWidth(); if (Float.compare(maxIntrinsicWidth, maxIntrinsicWidth2) < 0) { paragraphIntrinsicInfo2 = paragraphIntrinsicInfo3; maxIntrinsicWidth = maxIntrinsicWidth2; } if (i == lastIndex) { break; } i++; } } paragraphIntrinsicInfo = paragraphIntrinsicInfo2; } ParagraphIntrinsicInfo paragraphIntrinsicInfo4 = paragraphIntrinsicInfo; return Float.valueOf((paragraphIntrinsicInfo4 == null || (intrinsics = paragraphIntrinsicInfo4.getIntrinsics()) == null) ? 0.0f : intrinsics.getMaxIntrinsicWidth()); } }); ParagraphStyle paragraphStyle = textStyle.toParagraphStyle(); List> normalizedParagraphStyles = AnnotatedStringKt.normalizedParagraphStyles(annotatedString2, paragraphStyle); ArrayList arrayList = new ArrayList(normalizedParagraphStyles.size()); int size = normalizedParagraphStyles.size(); int i = 0; while (i < size) { AnnotatedString.Range range = normalizedParagraphStyles.get(i); AnnotatedString substringWithoutParagraphStyles = AnnotatedStringKt.substringWithoutParagraphStyles(annotatedString2, range.getStart(), range.getEnd()); ParagraphStyle resolveTextDirection = resolveTextDirection(range.getItem(), paragraphStyle); String text = substringWithoutParagraphStyles.getText(); TextStyle merge = style.merge(resolveTextDirection); List> spanStyles = substringWithoutParagraphStyles.getSpanStyles(); localPlaceholders = MultiParagraphIntrinsicsKt.getLocalPlaceholders(getPlaceholders(), range.getStart(), range.getEnd()); arrayList.add(new ParagraphIntrinsicInfo(ParagraphIntrinsicsKt.ParagraphIntrinsics(text, merge, spanStyles, (List>) localPlaceholders, density, fontFamilyResolver), range.getStart(), range.getEnd())); i++; annotatedString2 = annotatedString; style = textStyle; } this.infoList = arrayList; } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ @Deprecated(message = "Font.ResourceLoader is deprecated, call with fontFamilyResolver", replaceWith = @ReplaceWith(expression = "MultiParagraphIntrinsics(annotatedString, style, placeholders, density, fontFamilyResolver)", imports = {})) public MultiParagraphIntrinsics(AnnotatedString annotatedString, TextStyle style, List> placeholders, Density density, Font.ResourceLoader resourceLoader) { this(annotatedString, style, placeholders, density, DelegatingFontLoaderForDeprecatedUsage_androidKt.createFontFamilyResolver(resourceLoader)); Intrinsics.checkNotNullParameter(annotatedString, "annotatedString"); Intrinsics.checkNotNullParameter(style, "style"); Intrinsics.checkNotNullParameter(placeholders, "placeholders"); Intrinsics.checkNotNullParameter(density, "density"); Intrinsics.checkNotNullParameter(resourceLoader, "resourceLoader"); } @Override // androidx.compose.ui.text.ParagraphIntrinsics public float getMinIntrinsicWidth() { return ((Number) this.minIntrinsicWidth.getValue()).floatValue(); } @Override // androidx.compose.ui.text.ParagraphIntrinsics public float getMaxIntrinsicWidth() { return ((Number) this.maxIntrinsicWidth.getValue()).floatValue(); } /* JADX INFO: Access modifiers changed from: private */ public final ParagraphStyle resolveTextDirection(ParagraphStyle style, ParagraphStyle defaultStyle) { ParagraphStyle m4321copyNH1kkwU; TextDirection textDirection = style.getTextDirection(); if (textDirection != null) { textDirection.getValue(); if (style != null) { return style; } } m4321copyNH1kkwU = style.m4321copyNH1kkwU((r22 & 1) != 0 ? style.textAlign : null, (r22 & 2) != 0 ? style.textDirection : defaultStyle.getTextDirection(), (r22 & 4) != 0 ? style.lineHeight : 0L, (r22 & 8) != 0 ? style.textIndent : null, (r22 & 16) != 0 ? style.platformStyle : null, (r22 & 32) != 0 ? style.lineHeightStyle : null, (r22 & 64) != 0 ? style.lineBreak : null, (r22 & 128) != 0 ? style.hyphens : null, (r22 & 256) != 0 ? style.textMotion : null); return m4321copyNH1kkwU; } @Override // androidx.compose.ui.text.ParagraphIntrinsics public boolean getHasStaleResolvedFonts() { List list = this.infoList; int size = list.size(); for (int i = 0; i < size; i++) { if (list.get(i).getIntrinsics().getHasStaleResolvedFonts()) { return true; } } return false; } }