package kotlinx.coroutines.flow;

/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes3.dex */
@kotlin.Metadata(k = 3, mv = {2, 1, 0}, xi = 48)
@kotlin.jvm.internal.SourceDebugExtension
final class FlowKt__TransformKt$withIndex$1$1<T> implements kotlinx.coroutines.flow.FlowCollector {
    final /* synthetic */ kotlinx.coroutines.flow.FlowCollector a;
    final /* synthetic */ kotlin.jvm.internal.Ref.IntRef b;

    FlowKt__TransformKt$withIndex$1$1(kotlinx.coroutines.flow.FlowCollector flowCollector, kotlin.jvm.internal.Ref.IntRef intRef) {
        this.a = flowCollector;
        this.b = intRef;
    }

    /* JADX WARN: Code duplicated, block: B:7:0x0013  */
    @Override // kotlinx.coroutines.flow.FlowCollector
    public final java.lang.Object emit(java.lang.Object obj, kotlin.coroutines.Continuation continuation) {
        kotlinx.coroutines.flow.FlowKt__TransformKt$withIndex$1$1$emit$1 flowKt__TransformKt$withIndex$1$1$emit$1;
        if (continuation instanceof kotlinx.coroutines.flow.FlowKt__TransformKt$withIndex$1$1$emit$1) {
            flowKt__TransformKt$withIndex$1$1$emit$1 = (kotlinx.coroutines.flow.FlowKt__TransformKt$withIndex$1$1$emit$1) continuation;
            int i = flowKt__TransformKt$withIndex$1$1$emit$1.p;
            if ((i & Integer.MIN_VALUE) != 0) {
                flowKt__TransformKt$withIndex$1$1$emit$1.p = i - Integer.MIN_VALUE;
            } else {
                flowKt__TransformKt$withIndex$1$1$emit$1 = new kotlinx.coroutines.flow.FlowKt__TransformKt$withIndex$1$1$emit$1(this, continuation);
            }
        } else {
            flowKt__TransformKt$withIndex$1$1$emit$1 = new kotlinx.coroutines.flow.FlowKt__TransformKt$withIndex$1$1$emit$1(this, continuation);
        }
        java.lang.Object obj2 = flowKt__TransformKt$withIndex$1$1$emit$1.n;
        java.lang.Object objG = kotlin.coroutines.intrinsics.IntrinsicsKt.g();
        int i2 = flowKt__TransformKt$withIndex$1$1$emit$1.p;
        if (i2 == 0) {
            kotlin.ResultKt.b(obj2);
            kotlinx.coroutines.flow.FlowCollector flowCollector = this.a;
            kotlin.jvm.internal.Ref.IntRef intRef = this.b;
            int i5 = intRef.a;
            intRef.a = i5 + 1;
            if (i5 < 0) {
                throw new java.lang.ArithmeticException("Index overflow has happened");
            }
            kotlin.collections.IndexedValue indexedValue = new kotlin.collections.IndexedValue(i5, obj);
            flowKt__TransformKt$withIndex$1$1$emit$1.p = 1;
            if (flowCollector.emit(indexedValue, flowKt__TransformKt$withIndex$1$1$emit$1) == objG) {
                return objG;
            }
        } else {
            if (i2 != 1) {
                throw new java.lang.IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            kotlin.ResultKt.b(obj2);
        }
        return kotlin.Unit.a;
    }
}
