package S3;

import C0.J;
import E3.v;
import java.security.GeneralSecurityException;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicReference;

/* JADX INFO: loaded from: classes3.dex */
public final class i {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final i f6231b = new i();

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final AtomicReference f6232a = new AtomicReference(new s(new J(5)));

    public final L3.b a(o oVar) {
        AtomicReference atomicReference = this.f6232a;
        s sVar = (s) atomicReference.get();
        sVar.getClass();
        Z3.a aVar = oVar.f6242b;
        if (!sVar.f6253b.containsKey(new q(o.class, aVar))) {
            try {
                e eVar = new e();
                oVar.f6244d.ordinal();
                return eVar;
            } catch (GeneralSecurityException e6) {
                throw new v("Creating a LegacyProtoKey failed", e6);
            }
        }
        s sVar2 = (s) atomicReference.get();
        sVar2.getClass();
        q qVar = new q(o.class, aVar);
        HashMap map = sVar2.f6253b;
        if (map.containsKey(qVar)) {
            return ((a) map.get(qVar)).f6219b.c(oVar);
        }
        throw new GeneralSecurityException("No Key Parser for requested key type " + qVar + " available");
    }

    public final synchronized void b(a aVar) {
        J j4 = new J((s) this.f6232a.get());
        j4.i(aVar);
        this.f6232a.set(new s(j4));
    }

    public final synchronized void c(b bVar) {
        J j4 = new J((s) this.f6232a.get());
        j4.j(bVar);
        this.f6232a.set(new s(j4));
    }

    public final synchronized void d(j jVar) {
        J j4 = new J((s) this.f6232a.get());
        j4.k(jVar);
        this.f6232a.set(new s(j4));
    }

    public final synchronized void e(k kVar) {
        J j4 = new J((s) this.f6232a.get());
        j4.l(kVar);
        this.f6232a.set(new s(j4));
    }
}
