package io.flutter.plugins.sharedpreferences;

import android.content.Context;
import g7.z;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.CoroutineSingletons;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SpillingKt;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Ref$ObjectRef;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.x;

/* JADX INFO: loaded from: classes.dex */
@Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0002\n\u0002\u0018\u0002\u0010\u0000\u001a\u00020\u0001*\u00020\u0002H\n"}, d2 = {"<anonymous>", "", "Lkotlinx/coroutines/CoroutineScope;"}, k = 3, mv = {2, 2, 0}, xi = 48)
@DebugMetadata(c = "io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin$getInt$1", f = "SharedPreferencesPlugin.kt", i = {0, 0}, l = {160}, m = "invokeSuspend", n = {"preferencesKey", "preferenceFlow"}, s = {"L$0", "L$1"})
@SourceDebugExtension({"SMAP\nSharedPreferencesPlugin.kt\nKotlin\n*S Kotlin\n*F\n+ 1 SharedPreferencesPlugin.kt\nio/flutter/plugins/sharedpreferences/SharedPreferencesPlugin$getInt$1\n+ 2 Transform.kt\nkotlinx/coroutines/flow/FlowKt__TransformKt\n+ 3 Emitters.kt\nkotlinx/coroutines/flow/FlowKt__EmittersKt\n+ 4 SafeCollector.common.kt\nkotlinx/coroutines/flow/internal/SafeCollector_commonKt\n*L\n1#1,520:1\n53#2:521\n55#2:525\n50#3:522\n55#3:524\n107#4:523\n*S KotlinDebug\n*F\n+ 1 SharedPreferencesPlugin.kt\nio/flutter/plugins/sharedpreferences/SharedPreferencesPlugin$getInt$1\n*L\n159#1:521\n159#1:525\n159#1:522\n159#1:524\n159#1:523\n*E\n"})
final class SharedPreferencesPlugin$getInt$1 extends SuspendLambda implements Function2 {
    final /* synthetic */ String $key;
    final /* synthetic */ Ref$ObjectRef<Long> $value;
    Object L$0;
    Object L$1;
    Object L$2;
    int label;
    final /* synthetic */ SharedPreferencesPlugin this$0;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public SharedPreferencesPlugin$getInt$1(String str, SharedPreferencesPlugin sharedPreferencesPlugin, Ref$ObjectRef ref$ObjectRef, Continuation continuation) {
        super(2, continuation);
        this.$key = str;
        this.this$0 = sharedPreferencesPlugin;
        this.$value = ref$ObjectRef;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Continuation create(Object obj, Continuation continuation) {
        return new SharedPreferencesPlugin$getInt$1(this.$key, this.this$0, this.$value, continuation);
    }

    @Override // kotlin.jvm.functions.Function2
    public final Object invoke(Object obj, Object obj2) {
        return ((SharedPreferencesPlugin$getInt$1) create((x) obj, (Continuation) obj2)).invokeSuspend(kd.e.f29109a);
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Object invokeSuspend(Object obj) {
        Ref$ObjectRef<Long> ref$ObjectRef;
        T t10;
        CoroutineSingletons coroutineSingletons = CoroutineSingletons.f29226a;
        int i10 = this.label;
        if (i10 == 0) {
            kotlin.a.d(obj);
            androidx.datastore.preferences.core.d dVarD = z.d(this.$key);
            Context context = this.this$0.f28311a;
            if (context == null) {
                nb.g.U("context");
                throw null;
            }
            l lVar = new l(t.a(context).getData(), dVarD, 1);
            Ref$ObjectRef<Long> ref$ObjectRef2 = this.$value;
            this.L$0 = SpillingKt.nullOutSpilledVariable(dVarD);
            this.L$1 = SpillingKt.nullOutSpilledVariable(lVar);
            this.L$2 = ref$ObjectRef2;
            this.label = 1;
            Object objG = kotlinx.coroutines.flow.h.g(lVar, this);
            if (objG == coroutineSingletons) {
                return coroutineSingletons;
            }
            ref$ObjectRef = ref$ObjectRef2;
            t10 = objG;
        } else {
            if (i10 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            ref$ObjectRef = (Ref$ObjectRef) this.L$2;
            kotlin.a.d(obj);
            t10 = obj;
        }
        ref$ObjectRef.element = t10;
        return kd.e.f29109a;
    }
}
