package xyz.netfly.player;

import android.widget.TextView;
import java.util.ArrayList;
import java.util.Locale;
import java.util.NoSuchElementException;
import org.drive_hunter.R;
import tv.danmaku.ijk.media.player.ui.subtitleconverter.SubtitleView;
import xyz.stream.api.entity.SubtitlePlayEntity;
import xyz.stream.utils.f0;

/* JADX INFO: loaded from: classes3.dex */
public final /* synthetic */ class c implements Runnable {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f35181a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ n f35182b;

    public /* synthetic */ c(n nVar, int i10) {
        this.f35181a = i10;
        this.f35182b = nVar;
    }

    @Override // java.lang.Runnable
    public final void run() {
        Object objApply;
        int i10 = this.f35181a;
        n nVar = this.f35182b;
        switch (i10) {
            case 0:
                nVar.getClass();
                String strQ = f0.o().q("flutter.spSubtitleLanguage", null);
                xyz.stream.utils.o oVarC = xyz.stream.utils.o.c();
                xyz.stream.utils.e.d().getClass();
                String strD = oVarC.d(xyz.stream.utils.e.e());
                String strD2 = xyz.stream.utils.o.c().d(Locale.getDefault().getLanguage());
                ArrayList arrayList = nVar.f35217c;
                if (strQ == null) {
                    strQ = strD;
                } else if (strQ.equals(nVar.f35233s.getString(R.string.others))) {
                    t4.d dVarG = t4.f.x(arrayList).e(new b(nVar, 1)).g();
                    fa.h hVar = new fa.h(23);
                    t4.d dVar = t4.d.f32946b;
                    Object obj = dVarG.f32947a;
                    if (obj != null && (objApply = hVar.apply(obj)) != null) {
                        dVar = new t4.d(objApply);
                    }
                    Object obj2 = dVar.f32947a;
                    if (obj2 == null) {
                        obj2 = strD;
                    }
                    strQ = (String) obj2;
                }
                t4.e eVarG = nVar.g(strQ, false);
                if (!eVarG.f32949a) {
                    eVarG = nVar.g(strD, false);
                }
                if (!eVarG.f32949a) {
                    eVarG = nVar.g(strD2, false);
                }
                boolean z10 = eVarG.f32949a;
                if (z10) {
                    if (!z10) {
                        throw new NoSuchElementException("No value present");
                    }
                    nVar.s(eVarG.f32950b, true);
                    return;
                } else {
                    if (arrayList.size() <= 1) {
                        nVar.s(0, true);
                        return;
                    }
                    t4.d dVarG2 = t4.f.x(arrayList).e(new fa.h(24)).g();
                    Object subtitlePlayEntity = new SubtitlePlayEntity("Off", -1, null);
                    Object obj3 = dVarG2.f32947a;
                    if (obj3 != null) {
                        subtitlePlayEntity = obj3;
                    }
                    nVar.s(arrayList.indexOf(subtitlePlayEntity), true);
                    return;
                }
            case 1:
                TextView textViewI = nVar.i();
                if (textViewI != null) {
                    textViewI.setVisibility(8);
                    return;
                }
                return;
            case 2:
                TextView textViewI2 = nVar.i();
                if (textViewI2 == null) {
                    return;
                }
                textViewI2.setVisibility(0);
                textViewI2.setText(nVar.f35219e);
                return;
            default:
                SubtitleView subtitleViewK = nVar.k();
                TextView textViewI3 = nVar.i();
                if (subtitleViewK == null || textViewI3 == null) {
                    return;
                }
                textViewI3.setVisibility(8);
                textViewI3.setText(nVar.f35220f);
                subtitleViewK.setData(null);
                subtitleViewK.setStop();
                return;
        }
    }
}
