package h3;

import android.content.Context;
import android.os.SystemClock;
import android.speech.SpeechRecognizer;
import androidx.compose.runtime.MutableLongState;
import androidx.compose.runtime.MutableState;
import androidx.compose.runtime.State;
import com.debridstream.tv.data.home.HomeMetaItem;
import e.C1956j;
import m3.AbstractC2467b;
import w4.C3137A;

/* JADX INFO: renamed from: h3.l2, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class C2147l2 implements J4.a {

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

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ Object f18144c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ Object f18145d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ Object f18146e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final /* synthetic */ State f18147f;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final /* synthetic */ State f18148j;

    public /* synthetic */ C2147l2(V4.C c6, Context context, HomeMetaItem homeMetaItem, boolean z6, State state, State state2) {
        this.f18144c = c6;
        this.f18145d = context;
        this.f18146e = homeMetaItem;
        this.f18143b = z6;
        this.f18147f = state;
        this.f18148j = state2;
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // J4.a
    public final Object invoke() {
        switch (this.f18142a) {
            case 0:
                MutableState mutableState = (MutableState) this.f18146e;
                mutableState.setValue(null);
                if (this.f18143b) {
                    MutableState mutableState2 = (MutableState) this.f18147f;
                    if (((Boolean) mutableState2.getValue()).booleanValue()) {
                        try {
                            SpeechRecognizer speechRecognizer = ((a3.a0) this.f18144c).f10616b;
                            if (speechRecognizer != null) {
                                speechRecognizer.stopListening();
                            }
                        } catch (Throwable th) {
                            AbstractC2467b.d(th);
                        }
                        mutableState2.setValue(Boolean.FALSE);
                    } else {
                        long jElapsedRealtime = SystemClock.elapsedRealtime();
                        MutableLongState mutableLongState = (MutableLongState) this.f18148j;
                        if (jElapsedRealtime - mutableLongState.getLongValue() >= 750) {
                            mutableLongState.setLongValue(jElapsedRealtime);
                            ((C1956j) this.f18145d).a("android.permission.RECORD_AUDIO");
                        }
                    }
                } else {
                    mutableState.setValue("Speech recognition not available");
                }
                break;
            default:
                V4.E.y((V4.C) this.f18144c, null, null, new C2131i4((Context) this.f18145d, (HomeMetaItem) this.f18146e, this.f18143b, this.f18147f, this.f18148j, null), 3);
                break;
        }
        return C3137A.f25453a;
    }

    public /* synthetic */ C2147l2(boolean z6, a3.a0 a0Var, C1956j c1956j, MutableState mutableState, MutableState mutableState2, MutableLongState mutableLongState) {
        this.f18143b = z6;
        this.f18144c = a0Var;
        this.f18145d = c1956j;
        this.f18146e = mutableState;
        this.f18147f = mutableState2;
        this.f18148j = mutableLongState;
    }
}
