package f5;

import Z6.InterfaceC0382w;
import a5.C0405d;
import android.content.SharedPreferences;
import com.google.android.gms.internal.measurement.C1;
import com.martsnew.data.model.request.LogoutRequest;
import com.martsnew.data.model.response.LoginResponse;
import d5.AbstractC0844a;
import e5.InterfaceC0881a;

/* JADX INFO: renamed from: f5.M, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0936M extends G6.i implements O6.p {

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public int f12747u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final /* synthetic */ C0939P f12748v;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C0936M(C0939P c0939p, E6.d dVar) {
        super(2, dVar);
        this.f12748v = c0939p;
    }

    @Override // O6.p
    public final Object k(Object obj, Object obj2) {
        return ((C0936M) m((E6.d) obj2, (InterfaceC0382w) obj)).p(A6.n.f457a);
    }

    @Override // G6.a
    public final E6.d m(E6.d dVar, Object obj) {
        return new C0936M(this.f12748v, dVar);
    }

    /* JADX WARN: Removed duplicated region for block: B:40:0x00d7  */
    @Override // G6.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object p(Object obj) throws Throwable {
        Object obj2;
        Object objJ;
        F6.a aVar = F6.a.f2580q;
        int i = this.f12747u;
        C0939P c0939p = this.f12748v;
        if (i == 0) {
            C1.N(obj);
            C0405d c0405d = c0939p.f12759b;
            String strK = g6.o.f12958a.K();
            P6.d dVarA = P6.n.a(LoginResponse.class);
            boolean zEquals = dVarA.equals(P6.n.a(Float.TYPE));
            SharedPreferences sharedPreferences = c0405d.f7619a;
            if (zEquals) {
                obj2 = (LoginResponse) new Float(sharedPreferences.getFloat(strK, 0.0f));
            } else if (dVarA.equals(P6.n.a(Integer.TYPE))) {
                obj2 = (LoginResponse) new Integer(sharedPreferences.getInt(strK, 0));
            } else if (dVarA.equals(P6.n.a(Long.TYPE))) {
                obj2 = (LoginResponse) new Long(sharedPreferences.getLong(strK, 0L));
            } else if (dVarA.equals(P6.n.a(String.class))) {
                Object string = sharedPreferences.getString(strK, "");
                if (string == null) {
                    throw new NullPointerException("null cannot be cast to non-null type com.martsnew.data.model.response.LoginResponse");
                }
                obj2 = (LoginResponse) string;
            } else if (dVarA.equals(P6.n.a(Boolean.TYPE))) {
                obj2 = (LoginResponse) Boolean.valueOf(sharedPreferences.getBoolean(strK, false));
            } else {
                String string2 = sharedPreferences.getString(strK, "");
                if (string2 == null || string2.length() == 0) {
                    obj2 = null;
                } else {
                    try {
                        objJ = c0405d.f7620b.a(LoginResponse.class).a(string2);
                    } catch (Throwable th) {
                        objJ = C1.j(th);
                    }
                    if (!(objJ instanceof A6.i)) {
                        obj2 = objJ;
                    }
                }
            }
            LoginResponse loginResponse = (LoginResponse) obj2;
            if (loginResponse == null) {
                return new X4.a(new W4.b());
            }
            String str = loginResponse.f10852b.f10968b.f10971a;
            InterfaceC0881a interfaceC0881a = c0939p.f12758a;
            String strL = AbstractC0844a.l(C1.v(c0939p.f12759b), g6.o.f12958a.V());
            LogoutRequest logoutRequest = new LogoutRequest(str);
            this.f12747u = 1;
            obj = interfaceC0881a.g(strL, logoutRequest, this);
            if (obj == aVar) {
                return aVar;
            }
        } else {
            if (i != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            C1.N(obj);
        }
        X4.b bVar = new X4.b(obj);
        C0405d c0405d2 = c0939p.f12759b;
        String strK2 = g6.o.f12958a.K();
        P6.g.e(strK2, "key");
        SharedPreferences.Editor editorEdit = c0405d2.f7619a.edit();
        editorEdit.remove(strK2);
        editorEdit.apply();
        return bVar;
    }
}
