package com.strmr.ps.ui.contextmenu;

import com.strmr.ps.data.model.ContentItem;
import com.strmr.ps.data.repository.TraktStatusProvider;
import com.strmr.ps.ui.contextmenu.a;
import defpackage.af1;
import defpackage.ak1;
import defpackage.ck1;
import defpackage.cr4;
import defpackage.e6a;
import defpackage.gr3;
import defpackage.m02;
import defpackage.m12;
import defpackage.me1;
import defpackage.qm5;
import defpackage.s38;
import defpackage.sc2;
import defpackage.sm5;
import defpackage.wj0;
import defpackage.y41;
import defpackage.zw8;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
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.contextmenu.ContextMenuHelper$showContextMenu$1", f = "ContextMenuHelper.kt", i = {1}, l = {61, 62, 87, 98}, m = "invokeSuspend", n = {"isAuthenticated"}, s = {"Z$0"})
final class t extends SuspendLambda implements gr3<ak1, Continuation<? super e6a>, Object> {
    public boolean a;
    public int b;
    public final /* synthetic */ h c;
    public final /* synthetic */ ContentItem d;
    public final /* synthetic */ af1 e;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public t(h hVar, ContentItem contentItem, af1 af1Var, Continuation continuation) {
        super(2, continuation);
        this.c = hVar;
        this.d = contentItem;
        this.e = af1Var;
    }

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

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

    /* JADX WARN: Code restructure failed: missing block: B:49:0x00c9, code lost:
    
        if (defpackage.wj0.f(r1, r5, r10) != r0) goto L54;
     */
    /* JADX WARN: Code restructure failed: missing block: B:52:0x00db, code lost:
    
        if (defpackage.wj0.f(r11, r1, r10) != r0) goto L54;
     */
    /* JADX WARN: Removed duplicated region for block: B:43:0x00aa A[Catch: Exception -> 0x00cc, TryCatch #0 {Exception -> 0x00cc, blocks: (B:11:0x0024, B:14:0x002b, B:24:0x0062, B:26:0x006c, B:28:0x0070, B:34:0x0081, B:37:0x008d, B:39:0x0095, B:41:0x0099, B:43:0x00aa, B:45:0x00b1, B:47:0x00b5, B:48:0x00ba, B:31:0x0075, B:15:0x002f, B:21:0x0042, B:18:0x0036), top: B:56:0x000d }] */
    /* JADX WARN: Type inference failed for: r7v3, types: [java.lang.Object, java.util.Map] */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) throws Throwable {
        boolean zBooleanValue;
        ArrayList arrayListBp;
        af1 af1Var;
        String str;
        ck1 ck1Var = ck1.a;
        int i = this.b;
        ContentItem contentItem = this.d;
        h hVar = this.c;
        try {
        } catch (Exception unused) {
            m12 m12Var = sc2.a;
            qm5 qm5Var = sm5.a;
            s sVar = new s(hVar, null);
            this.b = 4;
        }
        if (i == 0) {
            s38.b(obj);
            TraktStatusProvider traktStatusProvider = hVar.d;
            this.b = 1;
            obj = traktStatusProvider.isAuthenticated(this);
            if (obj == ck1Var) {
            }
            return ck1Var;
        }
        if (i == 1) {
            s38.b(obj);
        } else {
            if (i != 2) {
                if (i != 3 && i != 4) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                s38.b(obj);
                return e6a.a;
            }
            zBooleanValue = this.a;
            s38.b(obj);
            arrayListBp = y41.bp((Collection) obj);
            if (hVar.j != null || hVar.k == null || hVar.l == null) {
                y41.ax(arrayListBp, new me1(3));
            }
            af1Var = this.e;
            if (af1Var != null && cr4.b(af1Var.d, "trakt_dropped_shows") && zBooleanValue) {
                arrayListBp.add(0, a.ab.c);
            }
            if (af1Var != null && hVar.i != null) {
                List list = zw8.a;
                str = af1Var.d;
                cr4.g(str, "rowType");
                if (zw8.n.containsKey(str)) {
                    arrayListBp.add(a.aa.c);
                }
            }
            if (af1Var != null && hVar.f != null) {
                arrayListBp.add(a.l.c);
            }
            m12 m12Var2 = sc2.a;
            qm5 qm5Var2 = sm5.a;
            r rVar = new r(hVar, contentItem, arrayListBp, null);
            this.b = 3;
        }
        zBooleanValue = ((Boolean) obj).booleanValue();
        ContextMenuActionHandler contextMenuActionHandler = hVar.c;
        this.a = zBooleanValue;
        this.b = 2;
        contextMenuActionHandler.getClass();
        m12 m12Var3 = sc2.a;
        obj = wj0.f(m02.c, new b(contentItem, contextMenuActionHandler, zBooleanValue, null), this);
        if (obj != ck1Var) {
            arrayListBp = y41.bp((Collection) obj);
            if (hVar.j != null) {
            }
            y41.ax(arrayListBp, new me1(3));
            af1Var = this.e;
            if (af1Var != null) {
                arrayListBp.add(0, a.ab.c);
            }
            if (af1Var != null) {
                List list2 = zw8.a;
                str = af1Var.d;
                cr4.g(str, "rowType");
                if (zw8.n.containsKey(str)) {
                }
            }
            if (af1Var != null) {
                arrayListBp.add(a.l.c);
            }
            m12 m12Var22 = sc2.a;
            qm5 qm5Var22 = sm5.a;
            r rVar2 = new r(hVar, contentItem, arrayListBp, null);
            this.b = 3;
        }
        return ck1Var;
    }
}
