package com.unity3d.ads.injection; import com.google.android.gms.ads.RequestConfiguration; import java.util.Map; import kotlin.Lazy; import kotlin.LazyKt__LazyJVMKt; import kotlin.TuplesKt; import kotlin.collections.MapsKt__MapsJVMKt; import kotlin.collections.MapsKt__MapsKt; import kotlin.jvm.functions.Function0; import kotlin.jvm.internal.Intrinsics; import kotlin.jvm.internal.Reflection; import kotlin.jvm.internal.SourceDebugExtension; import kotlinx.coroutines.flow.MutableStateFlow; import kotlinx.coroutines.flow.StateFlowKt; @SourceDebugExtension({"SMAP\nRegistry.kt\nKotlin\n*S Kotlin\n*F\n+ 1 Registry.kt\ncom/unity3d/ads/injection/Registry\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 3 StateFlow.kt\nkotlinx/coroutines/flow/StateFlowKt\n*L\n1#1,74:1\n1#2:75\n230#3,5:76\n*S KotlinDebug\n*F\n+ 1 Registry.kt\ncom/unity3d/ads/injection/Registry\n*L\n46#1:76,5\n*E\n"}) /* loaded from: classes4.dex */ public final class Registry { private final MutableStateFlow _services; public Registry() { Map emptyMap; emptyMap = MapsKt__MapsKt.emptyMap(); this._services = StateFlowKt.MutableStateFlow(emptyMap); } public final Map getServices() { return (Map) this._services.getValue(); } public static /* synthetic */ EntryKey single$default(Registry registry, String named, Function0 instance, int i, Object obj) { Lazy lazy; if ((i & 1) != 0) { named = ""; } Intrinsics.checkNotNullParameter(named, "named"); Intrinsics.checkNotNullParameter(instance, "instance"); Intrinsics.reifiedOperationMarker(4, RequestConfiguration.MAX_AD_CONTENT_RATING_T); EntryKey entryKey = new EntryKey(named, Reflection.getOrCreateKotlinClass(Object.class)); lazy = LazyKt__LazyJVMKt.lazy(instance); registry.add(entryKey, lazy); return entryKey; } public final /* synthetic */ EntryKey single(String named, Function0 instance) { Lazy lazy; Intrinsics.checkNotNullParameter(named, "named"); Intrinsics.checkNotNullParameter(instance, "instance"); Intrinsics.reifiedOperationMarker(4, RequestConfiguration.MAX_AD_CONTENT_RATING_T); EntryKey entryKey = new EntryKey(named, Reflection.getOrCreateKotlinClass(Object.class)); lazy = LazyKt__LazyJVMKt.lazy(instance); add(entryKey, lazy); return entryKey; } public static /* synthetic */ EntryKey factory$default(Registry registry, String named, Function0 instance, int i, Object obj) { if ((i & 1) != 0) { named = ""; } Intrinsics.checkNotNullParameter(named, "named"); Intrinsics.checkNotNullParameter(instance, "instance"); Intrinsics.reifiedOperationMarker(4, RequestConfiguration.MAX_AD_CONTENT_RATING_T); EntryKey entryKey = new EntryKey(named, Reflection.getOrCreateKotlinClass(Object.class)); registry.add(entryKey, new Factory(instance)); return entryKey; } public final /* synthetic */ EntryKey factory(String named, Function0 instance) { Intrinsics.checkNotNullParameter(named, "named"); Intrinsics.checkNotNullParameter(instance, "instance"); Intrinsics.reifiedOperationMarker(4, RequestConfiguration.MAX_AD_CONTENT_RATING_T); EntryKey entryKey = new EntryKey(named, Reflection.getOrCreateKotlinClass(Object.class)); add(entryKey, new Factory(instance)); return entryKey; } public final void add(EntryKey key, Lazy instance) { Object value; Map mapOf; Map plus; Intrinsics.checkNotNullParameter(key, "key"); Intrinsics.checkNotNullParameter(instance, "instance"); if (!(!getServices().containsKey(key))) { throw new IllegalStateException("Cannot have identical entries.".toString()); } MutableStateFlow mutableStateFlow = this._services; do { value = mutableStateFlow.getValue(); mapOf = MapsKt__MapsJVMKt.mapOf(TuplesKt.to(key, instance)); plus = MapsKt__MapsKt.plus((Map) value, mapOf); } while (!mutableStateFlow.compareAndSet(value, plus)); } public static /* synthetic */ Object get$default(Registry registry, String named, int i, Object obj) { if ((i & 1) != 0) { named = ""; } Intrinsics.checkNotNullParameter(named, "named"); Intrinsics.reifiedOperationMarker(4, RequestConfiguration.MAX_AD_CONTENT_RATING_T); EntryKey entryKey = new EntryKey(named, Reflection.getOrCreateKotlinClass(Object.class)); Lazy lazy = registry.getServices().get(entryKey); if (lazy == null) { throw new IllegalStateException("No entry found for " + entryKey); } Object value = lazy.getValue(); Intrinsics.reifiedOperationMarker(1, RequestConfiguration.MAX_AD_CONTENT_RATING_T); return value; } public final /* synthetic */ T get(String named) { Intrinsics.checkNotNullParameter(named, "named"); Intrinsics.reifiedOperationMarker(4, RequestConfiguration.MAX_AD_CONTENT_RATING_T); EntryKey entryKey = new EntryKey(named, Reflection.getOrCreateKotlinClass(Object.class)); Lazy lazy = getServices().get(entryKey); if (lazy == null) { throw new IllegalStateException("No entry found for " + entryKey); } T t = (T) lazy.getValue(); Intrinsics.reifiedOperationMarker(1, RequestConfiguration.MAX_AD_CONTENT_RATING_T); return t; } public static /* synthetic */ Object getOrNull$default(Registry registry, String named, int i, Object obj) { if ((i & 1) != 0) { named = ""; } Intrinsics.checkNotNullParameter(named, "named"); Intrinsics.reifiedOperationMarker(4, RequestConfiguration.MAX_AD_CONTENT_RATING_T); Lazy lazy = registry.getServices().get(new EntryKey(named, Reflection.getOrCreateKotlinClass(Object.class))); if (lazy == null) { return null; } Object value = lazy.getValue(); Intrinsics.reifiedOperationMarker(1, RequestConfiguration.MAX_AD_CONTENT_RATING_T); return value; } public final /* synthetic */ T getOrNull(String named) { Intrinsics.checkNotNullParameter(named, "named"); Intrinsics.reifiedOperationMarker(4, RequestConfiguration.MAX_AD_CONTENT_RATING_T); Lazy lazy = getServices().get(new EntryKey(named, Reflection.getOrCreateKotlinClass(Object.class))); if (lazy == null) { return null; } T t = (T) lazy.getValue(); Intrinsics.reifiedOperationMarker(1, RequestConfiguration.MAX_AD_CONTENT_RATING_T); return t; } }