package s4;

import android.util.Log;
import d3.D;
import java.util.concurrent.atomic.AtomicReference;
import l6.C1139a;
import org.json.JSONObject;
import u.AbstractC1563h;

/* JADX INFO: loaded from: classes.dex */
public final class b {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public Object f16864a;

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public Object f16866c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public Object f16867d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public Object f16868e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public Object f16869f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public Object f16870g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public Object f16871h;
    public Object i;

    public static void c(JSONObject jSONObject, String str) {
        StringBuilder sbB = AbstractC1563h.b(str);
        sbB.append(jSONObject.toString());
        String string = sbB.toString();
        if (Log.isLoggable("FirebaseCrashlytics", 3)) {
            Log.d("FirebaseCrashlytics", string, null);
        }
    }

    public C1521a a(int i) throws Throwable {
        C1521a c1521a = null;
        try {
            if (!AbstractC1563h.a(2, i)) {
                JSONObject jSONObjectV = ((C1139a) this.f16868e).v();
                if (jSONObjectV != null) {
                    C1521a c1521aU = ((C1139a) this.f16866c).u(jSONObjectV);
                    c(jSONObjectV, "Loaded cached settings: ");
                    ((D) this.f16867d).getClass();
                    long jCurrentTimeMillis = System.currentTimeMillis();
                    if (AbstractC1563h.a(3, i) || c1521aU.f16860c >= jCurrentTimeMillis) {
                        try {
                            if (Log.isLoggable("FirebaseCrashlytics", 2)) {
                                Log.v("FirebaseCrashlytics", "Returning cached settings.", null);
                            }
                            return c1521aU;
                        } catch (Exception e8) {
                            e = e8;
                            c1521a = c1521aU;
                            Log.e("FirebaseCrashlytics", "Failed to get cached settings", e);
                            return c1521a;
                        }
                    }
                    if (Log.isLoggable("FirebaseCrashlytics", 2)) {
                        Log.v("FirebaseCrashlytics", "Cached settings have expired.", null);
                        return null;
                    }
                } else if (Log.isLoggable("FirebaseCrashlytics", 3)) {
                    Log.d("FirebaseCrashlytics", "No cached settings data found.", null);
                }
            }
            return null;
        } catch (Exception e9) {
            e = e9;
        }
    }

    public C1521a b() {
        return (C1521a) ((AtomicReference) this.f16871h).get();
    }
}
