package com.strmr.ps.ui.player;

import android.widget.TextView;
import com.strmr.ps.data.model.tmdb.TMDBEpisode;
import com.strmr.ps.data.remote.api.TMDBApiService;
import defpackage.ak1;
import defpackage.ck1;
import defpackage.cr4;
import defpackage.e6a;
import defpackage.gr3;
import defpackage.mr8;
import defpackage.n89;
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;", "Le6a;", "<anonymous>", "(Lak1;)V"}, k = 3, mv = {2, 0, 0})
@DebugMetadata(c = "com.strmr.ps.ui.player.VideoPlayerActivity$fetchEpisodeName$1", f = "VideoPlayerActivity.kt", i = {}, l = {3917}, m = "invokeSuspend", n = {}, s = {})
final class q extends SuspendLambda implements gr3<ak1, Continuation<? super e6a>, Object> {
    public int a;
    public final /* synthetic */ VideoPlayerActivity b;
    public final /* synthetic */ int c;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public q(VideoPlayerActivity videoPlayerActivity, int i, Continuation continuation) {
        super(2, continuation);
        this.b = videoPlayerActivity;
        this.c = i;
    }

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

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

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Object invokeSuspend(Object obj) {
        int size;
        VideoPlayerActivity videoPlayerActivity = this.b;
        ck1 ck1Var = ck1.a;
        int i = this.a;
        try {
            if (i == 0) {
                s38.b(obj);
                TMDBApiService tMDBApiServiceAr = videoPlayerActivity.ar();
                int i2 = this.c;
                int i3 = videoPlayerActivity.bx;
                int i4 = videoPlayerActivity.bz;
                this.a = 1;
                obj = TMDBApiService.DefaultImpls.getEpisodeDetails$default(tMDBApiServiceAr, i2, i3, i4, null, this, 8, null);
                if (obj == ck1Var) {
                    return ck1Var;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                s38.b(obj);
            }
            String name = ((TMDBEpisode) obj).getName();
            if (name != null && !n89.ab(name)) {
                long[] jArr = VideoPlayerActivity.R0;
                if (videoPlayerActivity.cc) {
                    boolean z = mr8.a;
                    if (!mr8.a || (size = (mr8.c.size() - mr8.d) - 1) < 0) {
                        size = 0;
                    }
                    TextView textView = videoPlayerActivity.ag;
                    if (textView == null) {
                        cr4.n("episodeInfo");
                        throw null;
                    }
                    textView.setText("S" + videoPlayerActivity.bx + " E" + videoPlayerActivity.bz + " · " + name + " · Shuffle (" + size + " left)");
                } else {
                    TextView textView2 = videoPlayerActivity.ag;
                    if (textView2 == null) {
                        cr4.n("episodeInfo");
                        throw null;
                    }
                    textView2.setText("S" + videoPlayerActivity.bx + " E" + videoPlayerActivity.bz + " · " + name);
                }
            }
        } catch (Exception unused) {
        }
        return e6a.a;
    }
}
