package n5;

import A6.i;
import G6.c;
import P6.d;
import P6.g;
import P6.n;
import a5.C0405d;
import android.content.SharedPreferences;
import com.google.android.gms.internal.measurement.C1;
import com.martsnew.data.model.response.GenreListResponse;
import f5.C0926C;
import f5.C0951l;
import g6.o;
import h5.AbstractC1033b;
import j5.l;
import java.io.Serializable;
import java.util.List;
import n4.u0;
import o6.x;

/* JADX INFO: renamed from: n5.b, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1318b {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final C0926C f15521a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final l f15522b;

    public C1318b(C0926C c0926c, l lVar) {
        g.e(c0926c, "movieRepository");
        g.e(lVar, "genreMapper");
        this.f15521a = c0926c;
        this.f15522b = lVar;
    }

    /* JADX WARN: Removed duplicated region for block: B:44:0x00ee  */
    /* JADX WARN: Removed duplicated region for block: B:7:0x0013  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Serializable a(c cVar) {
        C1317a c1317a;
        Object objJ;
        C1318b c1318b;
        Object objU;
        if (cVar instanceof C1317a) {
            c1317a = (C1317a) cVar;
            int i = c1317a.f15520w;
            if ((i & Integer.MIN_VALUE) != 0) {
                c1317a.f15520w = i - Integer.MIN_VALUE;
            } else {
                c1317a = new C1317a(this, cVar);
            }
        }
        Object bVar = c1317a.f15518u;
        F6.a aVar = F6.a.f2580q;
        int i5 = c1317a.f15520w;
        if (i5 == 0) {
            C1.N(bVar);
            c1317a.f15517t = this;
            c1317a.f15520w = 1;
            C0926C c0926c = this.f15521a;
            C0405d c0405d = c0926c.f12714b;
            String strG = o.f12958a.G();
            d dVarA = n.a(GenreListResponse.class);
            boolean zEquals = dVarA.equals(n.a(Float.TYPE));
            SharedPreferences sharedPreferences = c0405d.f7619a;
            if (zEquals) {
                objJ = (GenreListResponse) Float.valueOf(sharedPreferences.getFloat(strG, 0.0f));
            } else if (dVarA.equals(n.a(Integer.TYPE))) {
                objJ = (GenreListResponse) Integer.valueOf(sharedPreferences.getInt(strG, 0));
            } else if (dVarA.equals(n.a(Long.TYPE))) {
                objJ = (GenreListResponse) Long.valueOf(sharedPreferences.getLong(strG, 0L));
            } else if (dVarA.equals(n.a(String.class))) {
                Object string = sharedPreferences.getString(strG, "");
                if (string == null) {
                    throw new NullPointerException("null cannot be cast to non-null type com.martsnew.data.model.response.GenreListResponse");
                }
                objJ = (GenreListResponse) string;
            } else if (dVarA.equals(n.a(Boolean.TYPE))) {
                objJ = (GenreListResponse) Boolean.valueOf(sharedPreferences.getBoolean(strG, false));
            } else {
                String string2 = sharedPreferences.getString(strG, "");
                if (string2 == null || string2.length() == 0) {
                    objJ = null;
                } else {
                    try {
                        objJ = c0405d.f7620b.a(GenreListResponse.class).a(string2);
                    } catch (Throwable th) {
                        objJ = C1.j(th);
                    }
                    if (objJ instanceof i) {
                    }
                }
            }
            GenreListResponse genreListResponse = (GenreListResponse) objJ;
            if (genreListResponse == null) {
                x xVar = AbstractC1033b.f13423a;
                bVar = AbstractC1033b.a(new C0951l(c0926c, null), c1317a);
            } else {
                bVar = new X4.b(genreListResponse);
            }
            if (bVar == aVar) {
                return aVar;
            }
            c1318b = this;
        } else {
            if (i5 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            c1318b = c1317a.f15517t;
            C1.N(bVar);
        }
        X4.c cVar2 = (X4.c) bVar;
        if (cVar2 instanceof X4.a) {
            objU = C1.j(((X4.a) cVar2).f7227a);
        } else {
            if (!(cVar2 instanceof X4.b)) {
                throw new A6.b();
            }
            l lVar = c1318b.f15522b;
            List list = ((GenreListResponse) ((X4.b) cVar2).f7228a).f10780a;
            lVar.getClass();
            objU = u0.u(lVar, list);
        }
        return (Serializable) objU;
    }
}
