package m4;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import k4.AbstractC2396i;
import k4.C2407u;

/* JADX INFO: loaded from: classes3.dex */
public final class r extends D {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ int f21138c = 0;

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public r(O0 o02, C2407u c2407u) {
        super(c2407u, 0);
        this.f21139d = o02;
    }

    @Override // m4.D
    public final void b() {
        List list;
        switch (this.f21138c) {
            case 0:
                C4.f fVar = (C4.f) this.f21139d;
                u4.b.c();
                try {
                    u4.c cVar = ((C2544t) fVar.f743d).f21154b;
                    u4.b.a();
                    u4.b.f24588a.getClass();
                    if (((k4.r0) fVar.f742c) == null) {
                        try {
                            ((AbstractC2396i) fVar.f741b).onReady();
                        } catch (Throwable th) {
                            k4.r0 r0VarG = k4.r0.f19939f.f(th).g("Failed to call onReady.");
                            fVar.f742c = r0VarG;
                            ((C2544t) fVar.f743d).f21162j.g(r0VarG);
                        }
                        break;
                    }
                    u4.b.f24588a.getClass();
                    return;
                } catch (Throwable th2) {
                    try {
                        u4.b.f24588a.getClass();
                        break;
                    } catch (Throwable th3) {
                        th2.addSuppressed(th3);
                    }
                    throw th2;
                }
            case 1:
                ((O0) this.f21139d).c();
                return;
            default:
                J j4 = (J) this.f21139d;
                j4.getClass();
                List arrayList = new ArrayList();
                while (true) {
                    synchronized (j4) {
                        try {
                            if (j4.f20652c.isEmpty()) {
                                j4.f20652c = null;
                                j4.f20651b = true;
                                return;
                            } else {
                                list = j4.f20652c;
                                j4.f20652c = arrayList;
                            }
                        } catch (Throwable th4) {
                            throw th4;
                        }
                    }
                    Iterator it = list.iterator();
                    while (it.hasNext()) {
                        ((Runnable) it.next()).run();
                    }
                    list.clear();
                    arrayList = list;
                }
                break;
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public r(O0 o02, J j4) {
        super(o02.f20702c, 0);
        this.f21139d = j4;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public r(C4.f fVar) {
        super(((C2544t) fVar.f743d).f21158f, 0);
        this.f21139d = fVar;
    }
}
