package o;

import android.text.TextUtils;
import android.util.Log;
import com.google.android.gms.common.internal.Preconditions;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class Nq0 extends AbstractC1429hs0 {
    public char c;
    public long d;
    public String e;
    public final C1984nl f;
    public final C1984nl g;
    public final C1984nl h;
    public final C1984nl i;
    public final C1984nl j;
    public final C1984nl k;
    public final C1984nl l;
    public final C1984nl m;
    public final C1984nl n;

    public Nq0(Kr0 kr0) {
        super(kr0);
        this.c = (char) 0;
        this.d = -1L;
        this.f = new C1984nl(this, 6, false, false);
        this.g = new C1984nl(this, 6, true, false);
        this.h = new C1984nl(this, 6, false, true);
        this.i = new C1984nl(this, 5, false, false);
        this.j = new C1984nl(this, 5, true, false);
        this.k = new C1984nl(this, 5, false, true);
        this.l = new C1984nl(this, 4, false, false);
        this.m = new C1984nl(this, 3, false, false);
        this.n = new C1984nl(this, 2, false, false);
    }

    public static Lq0 A(String str) {
        if (str == null) {
            return null;
        }
        return new Lq0(str);
    }

    public static String D(boolean z, String str, Object obj, Object obj2, Object obj3) {
        String strE = E(z, obj);
        String strE2 = E(z, obj2);
        String strE3 = E(z, obj3);
        StringBuilder sb = new StringBuilder();
        String str2 = "";
        if (str == null) {
            str = "";
        }
        if (!TextUtils.isEmpty(str)) {
            sb.append(str);
            str2 = ": ";
        }
        String str3 = ", ";
        if (!TextUtils.isEmpty(strE)) {
            sb.append(str2);
            sb.append(strE);
            str2 = ", ";
        }
        if (TextUtils.isEmpty(strE2)) {
            str3 = str2;
        } else {
            sb.append(str2);
            sb.append(strE2);
        }
        if (!TextUtils.isEmpty(strE3)) {
            sb.append(str3);
            sb.append(strE3);
        }
        return sb.toString();
    }

    public static String E(boolean z, Object obj) {
        int iLastIndexOf;
        String className;
        int iLastIndexOf2;
        if (obj == null) {
            return "";
        }
        if (obj instanceof Integer) {
            obj = Long.valueOf(((Integer) obj).intValue());
        }
        if (obj instanceof Long) {
            if (!z) {
                return obj.toString();
            }
            Long l = (Long) obj;
            if (Math.abs(l.longValue()) < 100) {
                return obj.toString();
            }
            char cCharAt = obj.toString().charAt(0);
            String strValueOf = String.valueOf(Math.abs(l.longValue()));
            long jRound = Math.round(Math.pow(10.0d, strValueOf.length() - 1));
            long jRound2 = Math.round(Math.pow(10.0d, strValueOf.length()) - 1.0d);
            int length = String.valueOf(jRound).length();
            String str = cCharAt == '-' ? "-" : "";
            StringBuilder sb = new StringBuilder(str.length() + str.length() + length + 3 + String.valueOf(jRound2).length());
            sb.append(str);
            sb.append(jRound);
            sb.append("...");
            sb.append(str);
            sb.append(jRound2);
            return sb.toString();
        }
        if (obj instanceof Boolean) {
            return obj.toString();
        }
        if (!(obj instanceof Throwable)) {
            return obj instanceof Lq0 ? ((Lq0) obj).a : z ? "-" : obj.toString();
        }
        Throwable th = (Throwable) obj;
        StringBuilder sb2 = new StringBuilder(z ? th.getClass().getName() : th.toString());
        String canonicalName = Kr0.class.getCanonicalName();
        String strSubstring = (TextUtils.isEmpty(canonicalName) || (iLastIndexOf = canonicalName.lastIndexOf(46)) == -1) ? "" : canonicalName.substring(0, iLastIndexOf);
        StackTraceElement[] stackTrace = th.getStackTrace();
        int length2 = stackTrace.length;
        int i = 0;
        while (true) {
            if (i >= length2) {
                break;
            }
            StackTraceElement stackTraceElement = stackTrace[i];
            if (!stackTraceElement.isNativeMethod() && (className = stackTraceElement.getClassName()) != null) {
                if (((TextUtils.isEmpty(className) || (iLastIndexOf2 = className.lastIndexOf(46)) == -1) ? "" : className.substring(0, iLastIndexOf2)).equals(strSubstring)) {
                    sb2.append(": ");
                    sb2.append(stackTraceElement);
                    break;
                }
            }
            i++;
        }
        return sb2.toString();
    }

    public final void B(int i, boolean z, boolean z2, String str, Object obj, Object obj2, Object obj3) {
        if (!z && Log.isLoggable(C(), i)) {
            Log.println(i, C(), D(false, str, obj, obj2, obj3));
        }
        if (z2 || i < 5) {
            return;
        }
        Preconditions.checkNotNull(str);
        Fr0 fr0 = ((Kr0) this.a).g;
        if (fr0 == null) {
            Log.println(6, C(), "Scheduler not set. Not logging error/warn");
        } else {
            if (!fr0.b) {
                Log.println(6, C(), "Scheduler not initialized. Not logging error/warn");
                return;
            }
            if (i >= 9) {
                i = 8;
            }
            fr0.B(new Jq0(this, i, str, obj, obj2, obj3));
        }
    }

    public final String C() {
        String str;
        synchronized (this) {
            try {
                if (this.e == null) {
                    ((Kr0) ((Kr0) this.a).d.a).getClass();
                    this.e = "FA";
                }
                Preconditions.checkNotNull(this.e);
                str = this.e;
            } catch (Throwable th) {
                throw th;
            }
        }
        return str;
    }

    @Override // o.AbstractC1429hs0
    public final boolean t() {
        return false;
    }

    public final C1984nl w() {
        return this.f;
    }

    public final C1984nl x() {
        return this.i;
    }

    public final C1984nl y() {
        return this.m;
    }

    public final C1984nl z() {
        return this.n;
    }
}
