package com.google.android.gms.internal.ads;

import androidx.annotation.Nullable;
import java.util.ArrayList;

/* JADX INFO: loaded from: classes2.dex */
public final class pj {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final int f15426a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final int f15427b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final int f15428c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final boolean f15429d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final h6 f15430e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final l2.h f15431f;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public int f15439n;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final Object f15432g = new Object();

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final ArrayList f15433h = new ArrayList();

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public final ArrayList f15434i = new ArrayList();

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final ArrayList f15435j = new ArrayList();

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public int f15436k = 0;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public int f15437l = 0;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public int f15438m = 0;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public String f15440o = "";

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public String f15441p = "";

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public String f15442q = "";

    public pj(int i10, int i11, int i12, int i13, int i14, int i15, int i16, boolean z10) {
        this.f15426a = i10;
        this.f15427b = i11;
        this.f15428c = i12;
        this.f15429d = z10;
        this.f15430e = new h6(i13, 3);
        this.f15431f = new l2.h(i14, i15, i16);
    }

    public static final String d(ArrayList arrayList) {
        if (arrayList.isEmpty()) {
            return "";
        }
        StringBuilder sb = new StringBuilder();
        int size = arrayList.size();
        int i10 = 0;
        while (i10 < size) {
            sb.append((String) arrayList.get(i10));
            sb.append(' ');
            i10++;
            if (sb.length() > 100) {
                break;
            }
        }
        sb.deleteCharAt(sb.length() - 1);
        String string = sb.toString();
        return string.length() < 100 ? string : string.substring(0, 100);
    }

    private final void zzm(@Nullable String str, boolean z10, float f10, float f11, float f12, float f13) {
        if (str != null) {
            if (str.length() < this.f15428c) {
                return;
            }
            synchronized (this.f15432g) {
                try {
                    this.f15433h.add(str);
                    this.f15436k += str.length();
                    if (z10) {
                        this.f15434i.add(str);
                        this.f15435j.add(new xj(f10, f11, f12, f13, r10.size() - 1));
                    }
                } catch (Throwable th) {
                    throw th;
                }
            }
        }
    }

    public final void a(String str, boolean z10, float f10, float f11, float f12, float f13) {
        zzm(str, z10, f10, f11, f12, f13);
        synchronized (this.f15432g) {
            try {
                if (this.f15438m < 0) {
                    q7.j.a("ActivityContent: negative number of WebViews.");
                }
                c();
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final void b(String str, boolean z10, float f10, float f11, float f12, float f13) {
        zzm(str, z10, f10, f11, f12, f13);
    }

    public final void c() {
        synchronized (this.f15432g) {
            try {
                int i10 = this.f15436k;
                int i11 = this.f15437l;
                boolean z10 = this.f15429d;
                int i12 = this.f15427b;
                if (!z10) {
                    i12 = (i11 * i12) + (i10 * this.f15426a);
                }
                if (i12 > this.f15439n) {
                    this.f15439n = i12;
                    m7.n nVar = m7.n.C;
                    if (!nVar.f30469h.g().o()) {
                        h6 h6Var = this.f15430e;
                        this.f15440o = h6Var.b(this.f15433h);
                        this.f15441p = h6Var.b(this.f15434i);
                    }
                    if (!nVar.f30469h.g().q()) {
                        this.f15442q = this.f15431f.g(this.f15434i, this.f15435j);
                    }
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final boolean equals(Object obj) {
        if (!(obj instanceof pj)) {
            return false;
        }
        if (obj == this) {
            return true;
        }
        String str = ((pj) obj).f15440o;
        return str != null && str.equals(this.f15440o);
    }

    public final int hashCode() {
        return this.f15440o.hashCode();
    }

    public final String toString() {
        ArrayList arrayList = this.f15433h;
        int i10 = this.f15437l;
        int i11 = this.f15439n;
        int i12 = this.f15436k;
        String strD = d(arrayList);
        String strD2 = d(this.f15434i);
        String str = this.f15440o;
        String str2 = this.f15441p;
        String str3 = this.f15442q;
        int length = String.valueOf(i10).length();
        int length2 = String.valueOf(i11).length();
        int length3 = String.valueOf(i12).length();
        int length4 = String.valueOf(strD).length();
        int length5 = String.valueOf(strD2).length();
        int length6 = String.valueOf(str).length();
        StringBuilder sb = new StringBuilder(length + 32 + length2 + 14 + length3 + 8 + length4 + 14 + length5 + 12 + length6 + 20 + String.valueOf(str2).length() + 32 + String.valueOf(str3).length());
        com.google.android.gms.measurement.internal.u1.y(sb, "ActivityContent fetchId: ", i10, " score:", i11);
        sb.append(" total_length:");
        sb.append(i12);
        sb.append("\n text: ");
        sb.append(strD);
        u.a.h(sb, "\n viewableText", strD2, "\n signture: ", str);
        return com.bytedance.sdk.component.adexpress.dynamic.dynamicview.b.h(sb, "\n viewableSignture: ", str2, "\n viewableSignatureForVertical: ", str3);
    }
}
