package v2;

import rm.n0;
import y0.y3;

/* loaded from: classes.dex */
public final class g0 {

    /* renamed from: a, reason: collision with root package name */
    private final y2.t f38957a = y2.s.a();

    /* renamed from: b, reason: collision with root package name */
    private final u2.b f38958b = new u2.b(16);

    /* loaded from: classes.dex */
    static final class a extends kotlin.jvm.internal.v implements dn.l {

        /* renamed from: q, reason: collision with root package name */
        final /* synthetic */ f0 f38960q;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        a(f0 f0Var) {
            super(1);
            this.f38960q = f0Var;
        }

        public final void a(h0 h0Var) {
            y2.t b10 = g0.this.b();
            g0 g0Var = g0.this;
            f0 f0Var = this.f38960q;
            synchronized (b10) {
                if (h0Var.f()) {
                    g0Var.f38958b.e(f0Var, h0Var);
                } else {
                    g0Var.f38958b.f(f0Var);
                }
                n0 n0Var = n0.f34904a;
            }
        }

        @Override // dn.l
        public /* bridge */ /* synthetic */ Object invoke(Object obj) {
            a((h0) obj);
            return n0.f34904a;
        }
    }

    public final y2.t b() {
        return this.f38957a;
    }

    public final y3 c(f0 f0Var, dn.l lVar) {
        synchronized (this.f38957a) {
            h0 h0Var = (h0) this.f38958b.d(f0Var);
            if (h0Var != null) {
                if (h0Var.f()) {
                    return h0Var;
                }
            }
            try {
                h0 h0Var2 = (h0) lVar.invoke(new a(f0Var));
                synchronized (this.f38957a) {
                    if (this.f38958b.d(f0Var) == null && h0Var2.f()) {
                        this.f38958b.e(f0Var, h0Var2);
                    }
                    n0 n0Var = n0.f34904a;
                }
                return h0Var2;
            } catch (Exception e10) {
                throw new IllegalStateException("Could not load font", e10);
            }
        }
    }
}
