package com.strmr.ps.ui.details;

import com.strmr.ps.data.model.tmdb.TMDBWatchProvidersResponse;
import com.strmr.ps.data.remote.RateLimiter;
import com.strmr.ps.data.remote.api.TMDBApiService;
import defpackage.ak1;
import defpackage.ck1;
import defpackage.e6a;
import defpackage.gr3;
import defpackage.s38;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0002\u001a\u00020\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0002\u0010\u0003"}, d2 = {"Lak1;", "Lcom/strmr/ps/data/model/tmdb/TMDBWatchProvidersResponse;", "<anonymous>", "(Lak1;)Lcom/strmr/ps/data/model/tmdb/TMDBWatchProvidersResponse;"}, k = 3, mv = {2, 0, 0})
@DebugMetadata(c = "com.strmr.ps.ui.details.DetailsFragment$fetchWatchProviders$1$watchProviders$1", f = "DetailsFragment.kt", i = {}, l = {623, 625, 627}, m = "invokeSuspend", n = {}, s = {})
final class o extends SuspendLambda implements gr3<ak1, Continuation<? super TMDBWatchProvidersResponse>, Object> {
    public int a;
    public final /* synthetic */ DetailsFragment b;
    public final /* synthetic */ boolean c;
    public final /* synthetic */ Integer d;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public o(DetailsFragment detailsFragment, boolean z, Integer num, Continuation continuation) {
        super(2, continuation);
        this.b = detailsFragment;
        this.c = z;
        this.d = num;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Continuation create(Object obj, Continuation continuation) {
        return new o(this.b, this.c, this.d, continuation);
    }

    @Override // defpackage.gr3
    public final Object invoke(Object obj, Object obj2) {
        return ((o) create((ak1) obj, (Continuation) obj2)).invokeSuspend(e6a.a);
    }

    /* JADX WARN: Code restructure failed: missing block: B:18:0x0049, code lost:
    
        if (r7 == r0) goto L24;
     */
    /* JADX WARN: Code restructure failed: missing block: B:23:0x005d, code lost:
    
        if (r7 == r0) goto L24;
     */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) {
        ck1 ck1Var = ck1.a;
        int i = this.a;
        DetailsFragment detailsFragment = this.b;
        if (i == 0) {
            s38.b(obj);
            RateLimiter rateLimiterT = detailsFragment.t();
            this.a = 1;
            if (rateLimiterT.a(this) != ck1Var) {
            }
            return ck1Var;
        }
        if (i != 1) {
            if (i == 2) {
                s38.b(obj);
                return (TMDBWatchProvidersResponse) obj;
            }
            if (i != 3) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            s38.b(obj);
            return (TMDBWatchProvidersResponse) obj;
        }
        s38.b(obj);
        boolean z = this.c;
        Integer num = this.d;
        if (z) {
            TMDBApiService tMDBApiServiceU = detailsFragment.u();
            int iIntValue = num.intValue();
            this.a = 2;
            obj = tMDBApiServiceU.getMovieWatchProviders(iIntValue, this);
        } else {
            TMDBApiService tMDBApiServiceU2 = detailsFragment.u();
            int iIntValue2 = num.intValue();
            this.a = 3;
            obj = tMDBApiServiceU2.getTvWatchProviders(iIntValue2, this);
        }
        return ck1Var;
    }
}
