package o;

import android.text.Layout;
import android.text.TextPaint;
import java.text.BreakIterator;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class N4 implements DV {
    public final String l;
    public final C0733af0 m;
    public final List n;

    /* renamed from: o, reason: collision with root package name */
    public final List f249o;
    public final InterfaceC2221qA p;
    public final InterfaceC2281qr q;
    public final G5 r;
    public final CharSequence s;
    public final C1566jK t;
    public C70 u;
    public final boolean v;
    public final int w;

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:11:0x006b  */
    /* JADX WARN: Removed duplicated region for block: B:14:0x0070  */
    /* JADX WARN: Removed duplicated region for block: B:172:0x0384  */
    /* JADX WARN: Removed duplicated region for block: B:217:0x0439  */
    /* JADX WARN: Removed duplicated region for block: B:242:0x04da  */
    /* JADX WARN: Removed duplicated region for block: B:245:0x04ed  */
    /* JADX WARN: Removed duplicated region for block: B:263:0x0521  */
    /* JADX WARN: Removed duplicated region for block: B:269:0x052c  */
    /* JADX WARN: Removed duplicated region for block: B:275:0x0538  */
    /* JADX WARN: Removed duplicated region for block: B:278:0x0573  */
    /* JADX WARN: Removed duplicated region for block: B:286:0x05aa  */
    /* JADX WARN: Removed duplicated region for block: B:316:0x0646  */
    /* JADX WARN: Removed duplicated region for block: B:325:0x0666  */
    /* JADX WARN: Removed duplicated region for block: B:379:0x07a7  */
    /* JADX WARN: Removed duplicated region for block: B:390:0x07d0  */
    /* JADX WARN: Removed duplicated region for block: B:404:0x0823  */
    /* JADX WARN: Removed duplicated region for block: B:412:0x084d A[LOOP:6: B:411:0x084b->B:412:0x084d, LOOP_END] */
    /* JADX WARN: Removed duplicated region for block: B:415:0x085e  */
    /* JADX WARN: Type inference failed for: r4v5, types: [java.util.List] */
    /* JADX WARN: Type inference failed for: r4v6, types: [java.util.Collection, java.util.List] */
    /* JADX WARN: Type inference failed for: r4v7, types: [java.util.ArrayList] */
    /* JADX WARN: Type inference failed for: r9v19, types: [android.text.Spannable] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public N4(java.lang.String r41, o.C0733af0 r42, java.util.List r43, java.util.List r44, o.InterfaceC2221qA r45, o.InterfaceC2281qr r46) {
        /*
            Method dump skipped, instructions count: 2216
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.N4.<init>(java.lang.String, o.af0, java.util.List, java.util.List, o.qA, o.qr):void");
    }

    @Override // o.DV
    public final float a() {
        float f;
        C1566jK c1566jK = this.t;
        float f2 = c1566jK.e;
        TextPaint textPaint = c1566jK.b;
        if (!Float.isNaN(f2)) {
            return c1566jK.e;
        }
        BreakIterator lineInstance = BreakIterator.getLineInstance(textPaint.getTextLocale());
        CharSequence charSequence = c1566jK.a;
        lineInstance.setText(new C2261qh(charSequence, charSequence.length()));
        PriorityQueue priorityQueue = new PriorityQueue(10, new C0347Nk(7));
        int i = 0;
        for (int next = lineInstance.next(); next != -1; next = lineInstance.next()) {
            if (priorityQueue.size() < 10) {
                priorityQueue.add(new C3001yV(Integer.valueOf(i), Integer.valueOf(next)));
            } else {
                C3001yV c3001yV = (C3001yV) priorityQueue.peek();
                if (c3001yV != null && ((Number) c3001yV.m).intValue() - ((Number) c3001yV.l).intValue() < next - i) {
                    priorityQueue.poll();
                    priorityQueue.add(new C3001yV(Integer.valueOf(i), Integer.valueOf(next)));
                }
            }
            i = next;
        }
        if (priorityQueue.isEmpty()) {
            f = 0.0f;
        } else {
            Iterator it = priorityQueue.iterator();
            if (!it.hasNext()) {
                throw new NoSuchElementException();
            }
            C3001yV c3001yV2 = (C3001yV) it.next();
            float desiredWidth = Layout.getDesiredWidth(c1566jK.b(), ((Number) c3001yV2.l).intValue(), ((Number) c3001yV2.m).intValue(), textPaint);
            while (it.hasNext()) {
                C3001yV c3001yV3 = (C3001yV) it.next();
                desiredWidth = Math.max(desiredWidth, Layout.getDesiredWidth(c1566jK.b(), ((Number) c3001yV3.l).intValue(), ((Number) c3001yV3.m).intValue(), textPaint));
            }
            f = desiredWidth;
        }
        c1566jK.e = f;
        return f;
    }

    @Override // o.DV
    public final boolean b() {
        C70 c70 = this.u;
        if (c70 != null ? c70.p() : false) {
            return true;
        }
        if (!this.v) {
            C2908xX c2908xX = this.m.c;
            C0247Jn c0247Jn = C2383rv.a;
            C0247Jn c0247Jn2 = C2383rv.a;
            InterfaceC3007ya0 interfaceC3007ya0J = (InterfaceC3007ya0) c0247Jn2.m;
            if (interfaceC3007ya0J == null) {
                if (C2004nv.d()) {
                    interfaceC3007ya0J = c0247Jn2.j();
                    c0247Jn2.m = interfaceC3007ya0J;
                } else {
                    interfaceC3007ya0J = AbstractC2798wI.i;
                }
            }
            if (((Boolean) interfaceC3007ya0J.getValue()).booleanValue()) {
                return true;
            }
        }
        return false;
    }

    @Override // o.DV
    public final float c() {
        return this.t.c();
    }
}
