package z2;

import E3.v;
import android.util.Log;
import java.util.ArrayList;
import java.util.Collection;
import kotlin.jvm.internal.o;
import n2.AbstractC2612c;
import x4.AbstractC3250p;
import x4.y;

/* JADX INFO: loaded from: classes.dex */
public final class g extends m1.g {

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

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

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

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

    public g(Object value, String str, a aVar, i verificationMode) {
        Collection collectionQ;
        o.h(value, "value");
        o.h(verificationMode, "verificationMode");
        this.f26306b = value;
        this.f26307c = str;
        this.f26308d = verificationMode;
        String message = m1.g.e(value, str);
        o.h(message, "message");
        k kVar = new k(message);
        StackTraceElement[] stackTrace = kVar.getStackTrace();
        o.g(stackTrace, "getStackTrace(...)");
        int length = stackTrace.length - 2;
        length = length < 0 ? 0 : length;
        if (length < 0) {
            throw new IllegalArgumentException(Z0.o.j(length, "Requested element count ", " is less than zero.").toString());
        }
        if (length == 0) {
            collectionQ = y.f26065a;
        } else {
            int length2 = stackTrace.length;
            if (length >= length2) {
                collectionQ = AbstractC3250p.X(stackTrace);
            } else if (length == 1) {
                collectionQ = AbstractC2612c.q(stackTrace[length2 - 1]);
            } else {
                ArrayList arrayList = new ArrayList(length);
                for (int i6 = length2 - length; i6 < length2; i6++) {
                    arrayList.add(stackTrace[i6]);
                }
                collectionQ = arrayList;
            }
        }
        kVar.setStackTrace((StackTraceElement[]) collectionQ.toArray(new StackTraceElement[0]));
        this.f26309e = kVar;
    }

    @Override // m1.g
    public final Object d() throws k {
        int iOrdinal = this.f26308d.ordinal();
        if (iOrdinal == 0) {
            throw this.f26309e;
        }
        if (iOrdinal != 1) {
            if (iOrdinal == 2) {
                return null;
            }
            throw new v();
        }
        String message = m1.g.e(this.f26306b, this.f26307c);
        o.h(message, "message");
        Log.d("f", message);
        return null;
    }

    @Override // m1.g
    public final m1.g n(String str, J4.c cVar) {
        return this;
    }
}
