package defpackage;

import android.os.SystemClock;
import java.io.Serializable;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;

/* JADX INFO: renamed from: ᵸᵹˆ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public class C5021 {

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public long f19026;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public Serializable f19027;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public long f19028;

    public C5021() {
        this.f19028 = -9223372036854775807L;
        this.f19026 = -9223372036854775807L;
    }

    public C5021(long j) {
        this.f19027 = new LinkedHashMap(100, 0.75f, true);
        this.f19028 = j;
    }

    /* JADX INFO: renamed from: ʽˈˋ */
    public int mo8451(Object obj) {
        return 1;
    }

    /* JADX INFO: renamed from: ːˏᵟᵯ */
    public void mo3301(Object obj, Object obj2) {
    }

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public void m10358(Exception exc) {
        long jElapsedRealtime = SystemClock.elapsedRealtime();
        if (((Exception) this.f19027) == null) {
            this.f19027 = exc;
        }
        if (this.f19028 == -9223372036854775807L && C0784.f3469.get() <= 0) {
            this.f19028 = 200 + jElapsedRealtime;
        }
        long j = this.f19028;
        if (j == -9223372036854775807L || jElapsedRealtime < j) {
            this.f19026 = jElapsedRealtime + 50;
            return;
        }
        Exception exc2 = (Exception) this.f19027;
        if (exc2 != exc) {
            exc2.addSuppressed(exc);
        }
        Exception exc3 = (Exception) this.f19027;
        this.f19027 = null;
        this.f19028 = -9223372036854775807L;
        this.f19026 = -9223372036854775807L;
        throw exc3;
    }

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public synchronized Object m10359(Object obj) {
        C1838 c1838;
        c1838 = (C1838) ((LinkedHashMap) this.f19027).get(obj);
        return c1838 != null ? c1838.f7294 : null;
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public synchronized Object m10360(Object obj, Object obj2) {
        int iMo8451 = mo8451(obj2);
        long j = iMo8451;
        if (j >= this.f19028) {
            mo3301(obj, obj2);
            return null;
        }
        if (obj2 != null) {
            this.f19026 += j;
        }
        C1838 c1838 = (C1838) ((LinkedHashMap) this.f19027).put(obj, obj2 == null ? null : new C1838(iMo8451, obj2));
        if (c1838 != null) {
            this.f19026 -= (long) c1838.f7293;
            if (!c1838.f7294.equals(obj2)) {
                mo3301(obj, c1838.f7294);
            }
        }
        m10361(this.f19028);
        return c1838 != null ? c1838.f7294 : null;
    }

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public synchronized void m10361(long j) {
        while (this.f19026 > j) {
            Iterator it = ((LinkedHashMap) this.f19027).entrySet().iterator();
            Map.Entry entry = (Map.Entry) it.next();
            C1838 c1838 = (C1838) entry.getValue();
            this.f19026 -= (long) c1838.f7293;
            Object key = entry.getKey();
            it.remove();
            mo3301(key, c1838.f7294);
        }
    }
}
