package com.unity3d.services.core.di; import c9.a; import com.google.android.gms.ads.RequestConfiguration; import d9.j; import d9.r; import h9.b; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import s8.g; import s8.i; /* loaded from: classes2.dex */ public final class ServicesRegistry implements IServicesRegistry { private final ConcurrentHashMap _services = new ConcurrentHashMap<>(); public static /* synthetic */ ServiceKey factory$default(ServicesRegistry servicesRegistry, String str, a aVar, int i10, Object obj) { if ((i10 & 1) != 0) { str = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED; } j.e(str, "named"); j.e(aVar, "instance"); j.i(4, RequestConfiguration.MAX_AD_CONTENT_RATING_T); ServiceKey serviceKey = new ServiceKey(str, r.a(Object.class)); servicesRegistry.updateService(serviceKey, ServiceFactoryKt.factoryOf(aVar)); return serviceKey; } public static /* synthetic */ Object get$default(ServicesRegistry servicesRegistry, String str, int i10, Object obj) { if ((i10 & 1) != 0) { str = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED; } j.e(str, "named"); j.i(4, RequestConfiguration.MAX_AD_CONTENT_RATING_T); return servicesRegistry.resolveService(new ServiceKey(str, r.a(Object.class))); } public static /* synthetic */ Object getOrNull$default(ServicesRegistry servicesRegistry, String str, int i10, Object obj) { if ((i10 & 1) != 0) { str = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED; } j.e(str, "named"); j.i(4, RequestConfiguration.MAX_AD_CONTENT_RATING_T); return servicesRegistry.resolveServiceOrNull(new ServiceKey(str, r.a(Object.class))); } public static /* synthetic */ ServiceKey single$default(ServicesRegistry servicesRegistry, String str, a aVar, int i10, Object obj) { g a10; if ((i10 & 1) != 0) { str = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED; } j.e(str, "named"); j.e(aVar, "instance"); j.i(4, RequestConfiguration.MAX_AD_CONTENT_RATING_T); ServiceKey serviceKey = new ServiceKey(str, r.a(Object.class)); a10 = i.a(aVar); servicesRegistry.updateService(serviceKey, a10); return serviceKey; } public final /* synthetic */ ServiceKey factory(String str, a aVar) { j.e(str, "named"); j.e(aVar, "instance"); j.i(4, RequestConfiguration.MAX_AD_CONTENT_RATING_T); ServiceKey serviceKey = new ServiceKey(str, r.a(Object.class)); updateService(serviceKey, ServiceFactoryKt.factoryOf(aVar)); return serviceKey; } public final /* synthetic */ T get(String str) { j.e(str, "named"); j.i(4, RequestConfiguration.MAX_AD_CONTENT_RATING_T); return (T) resolveService(new ServiceKey(str, r.a(Object.class))); } public final /* synthetic */ T getOrNull(String str) { j.e(str, "named"); j.i(4, RequestConfiguration.MAX_AD_CONTENT_RATING_T); return (T) resolveServiceOrNull(new ServiceKey(str, r.a(Object.class))); } @Override // com.unity3d.services.core.di.IServicesRegistry public T getService(String str, b bVar) { j.e(str, "named"); j.e(bVar, "instance"); return (T) resolveService(new ServiceKey(str, bVar)); } @Override // com.unity3d.services.core.di.IServicesRegistry public Map getServices() { return this._services; } @Override // com.unity3d.services.core.di.IServicesRegistry public T resolveService(ServiceKey serviceKey) { j.e(serviceKey, "key"); g gVar = getServices().get(serviceKey); if (gVar != null) { return (T) gVar.getValue(); } throw new IllegalStateException("No service instance found for " + serviceKey); } @Override // com.unity3d.services.core.di.IServicesRegistry public T resolveServiceOrNull(ServiceKey serviceKey) { j.e(serviceKey, "key"); g gVar = getServices().get(serviceKey); if (gVar != null) { return (T) gVar.getValue(); } return null; } public final /* synthetic */ ServiceKey single(String str, a aVar) { g a10; j.e(str, "named"); j.e(aVar, "instance"); j.i(4, RequestConfiguration.MAX_AD_CONTENT_RATING_T); ServiceKey serviceKey = new ServiceKey(str, r.a(Object.class)); a10 = i.a(aVar); updateService(serviceKey, a10); return serviceKey; } @Override // com.unity3d.services.core.di.IServicesRegistry public void updateService(ServiceKey serviceKey, g gVar) { j.e(serviceKey, "key"); j.e(gVar, "instance"); if (!(!getServices().containsKey(serviceKey))) { throw new IllegalStateException("Cannot have multiple identical services".toString()); } this._services.put(serviceKey, gVar); } }