package com.vinfast.companion.map.manager.searchchargingstation.vn;

/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes4.dex */
@kotlin.Metadata(d1 = {"\u0000T\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\b\u0018\u00002\u00020\u0001B!\b\u0007\u0012\u0006\u0010\u0003\u001a\u00020\u0002\u0012\u0006\u0010\u0005\u001a\u00020\u0004\u0012\u0006\u0010\u0007\u001a\u00020\u0006¢\u0006\u0004\b\b\u0010\tJ\u0018\u0010\r\u001a\u00020\f2\u0006\u0010\u000b\u001a\u00020\nH\u0082@¢\u0006\u0004\b\r\u0010\u000eJ\u0017\u0010\u0012\u001a\u00020\u00112\u0006\u0010\u0010\u001a\u00020\u000fH\u0002¢\u0006\u0004\b\u0012\u0010\u0013J\u001f\u0010\u0016\u001a\u00020\u00112\u0006\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u000b\u001a\u00020\nH\u0002¢\u0006\u0004\b\u0016\u0010\u0017J/\u0010\u001c\u001a\u001a\u0012\u0016\u0012\u0014\u0012\u0004\u0012\u00020\u0011\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u001b0\u001a0\u00190\u00182\u0006\u0010\u000b\u001a\u00020\nH\u0016¢\u0006\u0004\b\u001c\u0010\u001dR\u0014\u0010\u0003\u001a\u00020\u00028\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u001c\u0010\u001eR\u0014\u0010\u0005\u001a\u00020\u00048\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u001f\u0010 R\u0014\u0010\u0007\u001a\u00020\u00068\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b!\u0010\"¨\u0006#"}, d2 = {"Lcom/vinfast/companion/map/manager/searchchargingstation/vn/VinFastSearchChargingStationManager;", "Lcom/vinfast/companion/map/manager/searchchargingstation/SearchChargingStationManager;", "Lcom/vinfast/companion/core/base/storage/AppSharedPreference;", "appSharedPreference", "Lvn/vinfast/chargingkitapi/usecase/GetChargingStationsByLocation;", "getChargingStationsByLocation", "Lvn/vinfast/chargingkitapi/usecase/SetSettingStationSearchFilter;", "setSettingStationSearchFilter", "<init>", "(Lcom/vinfast/companion/core/base/storage/AppSharedPreference;Lvn/vinfast/chargingkitapi/usecase/GetChargingStationsByLocation;Lvn/vinfast/chargingkitapi/usecase/SetSettingStationSearchFilter;)V", "Lcom/vinfast/companion/map/manager/searchchargingstation/SearchChargingStationPayload;", "payload", "", "i", "(Lcom/vinfast/companion/map/manager/searchchargingstation/SearchChargingStationPayload;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "Lvn/vinfast/chargingkitapi/usecase/GetChargingStationsByLocation$Params;", "params", "", "g", "(Lvn/vinfast/chargingkitapi/usecase/GetChargingStationsByLocation$Params;)Z", "Lvn/vinfast/chargingkitapi/models/ChargingStation;", "chargingStation", "h", "(Lvn/vinfast/chargingkitapi/models/ChargingStation;Lcom/vinfast/companion/map/manager/searchchargingstation/SearchChargingStationPayload;)Z", "Lkotlinx/coroutines/flow/Flow;", "Lkotlin/Pair;", "", "Lcom/vinfast/companion/map/model/MapLocation;", "a", "(Lcom/vinfast/companion/map/manager/searchchargingstation/SearchChargingStationPayload;)Lkotlinx/coroutines/flow/Flow;", "Lcom/vinfast/companion/core/base/storage/AppSharedPreference;", "b", "Lvn/vinfast/chargingkitapi/usecase/GetChargingStationsByLocation;", "c", "Lvn/vinfast/chargingkitapi/usecase/SetSettingStationSearchFilter;", "hereSdk_release"}, k = 1, mv = {2, 2, 0}, xi = 48)
@kotlin.jvm.internal.SourceDebugExtension
public final class VinFastSearchChargingStationManager implements com.vinfast.companion.map.manager.searchchargingstation.SearchChargingStationManager {

    /* JADX INFO: renamed from: a, reason: from kotlin metadata */
    private final com.vinfast.companion.core.base.storage.AppSharedPreference appSharedPreference;

    /* JADX INFO: renamed from: b, reason: from kotlin metadata */
    private final vn.vinfast.chargingkitapi.usecase.GetChargingStationsByLocation getChargingStationsByLocation;

    /* JADX INFO: renamed from: c, reason: from kotlin metadata */
    private final vn.vinfast.chargingkitapi.usecase.SetSettingStationSearchFilter setSettingStationSearchFilter;

    public VinFastSearchChargingStationManager(com.vinfast.companion.core.base.storage.AppSharedPreference appSharedPreference, vn.vinfast.chargingkitapi.usecase.GetChargingStationsByLocation getChargingStationsByLocation, vn.vinfast.chargingkitapi.usecase.SetSettingStationSearchFilter setSettingStationSearchFilter) {
        kotlin.jvm.internal.Intrinsics.l(appSharedPreference, "appSharedPreference");
        kotlin.jvm.internal.Intrinsics.l(getChargingStationsByLocation, "getChargingStationsByLocation");
        kotlin.jvm.internal.Intrinsics.l(setSettingStationSearchFilter, "setSettingStationSearchFilter");
        this.appSharedPreference = appSharedPreference;
        this.getChargingStationsByLocation = getChargingStationsByLocation;
        this.setSettingStationSearchFilter = setSettingStationSearchFilter;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final boolean g(vn.vinfast.chargingkitapi.usecase.GetChargingStationsByLocation.Params params) {
        java.util.List listH = params.h();
        if (listH != null && listH.size() < 3) {
            return true;
        }
        java.lang.Boolean boolE = params.e();
        if (boolE != null && !boolE.booleanValue()) {
            return true;
        }
        java.lang.Boolean boolC = params.c();
        return ((boolC == null || boolC.booleanValue()) && params.a() == null && params.f() == null) ? false : true;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final boolean h(vn.vinfast.chargingkitapi.models.ChargingStation chargingStation, com.vinfast.companion.map.manager.searchchargingstation.SearchChargingStationPayload payload) {
        com.here.sdk.core.GeoBox boundingBox = payload.getBoundingBox();
        if (boundingBox == null) {
            return true;
        }
        kotlin.Pair pairP = chargingStation.p();
        double dDoubleValue = pairP != null ? ((java.lang.Number) pairP.e()).doubleValue() : 0.0d;
        kotlin.Pair pairP2 = chargingStation.p();
        return boundingBox.contains(new com.here.sdk.core.GeoCoordinates(dDoubleValue, pairP2 != null ? ((java.lang.Number) pairP2.f()).doubleValue() : 0.0d));
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* JADX WARN: Code duplicated, block: B:7:0x0013  */
    public final java.lang.Object i(com.vinfast.companion.map.manager.searchchargingstation.SearchChargingStationPayload searchChargingStationPayload, kotlin.coroutines.Continuation continuation) {
        com.vinfast.companion.map.manager.searchchargingstation.vn.VinFastSearchChargingStationManager$saveSettingIfNeeded$1 vinFastSearchChargingStationManager$saveSettingIfNeeded$1;
        if (continuation instanceof com.vinfast.companion.map.manager.searchchargingstation.vn.VinFastSearchChargingStationManager$saveSettingIfNeeded$1) {
            vinFastSearchChargingStationManager$saveSettingIfNeeded$1 = (com.vinfast.companion.map.manager.searchchargingstation.vn.VinFastSearchChargingStationManager$saveSettingIfNeeded$1) continuation;
            int i = vinFastSearchChargingStationManager$saveSettingIfNeeded$1.r;
            if ((i & Integer.MIN_VALUE) != 0) {
                vinFastSearchChargingStationManager$saveSettingIfNeeded$1.r = i - Integer.MIN_VALUE;
            } else {
                vinFastSearchChargingStationManager$saveSettingIfNeeded$1 = new com.vinfast.companion.map.manager.searchchargingstation.vn.VinFastSearchChargingStationManager$saveSettingIfNeeded$1(this, continuation);
            }
        } else {
            vinFastSearchChargingStationManager$saveSettingIfNeeded$1 = new com.vinfast.companion.map.manager.searchchargingstation.vn.VinFastSearchChargingStationManager$saveSettingIfNeeded$1(this, continuation);
        }
        java.lang.Object obj = vinFastSearchChargingStationManager$saveSettingIfNeeded$1.p;
        java.lang.Object objG = kotlin.coroutines.intrinsics.IntrinsicsKt.g();
        int i2 = vinFastSearchChargingStationManager$saveSettingIfNeeded$1.r;
        try {
            if (i2 == 0) {
                kotlin.ResultKt.b(obj);
                if (searchChargingStationPayload.getVn() == null && this.appSharedPreference.e("GL_SAVE_FILTER_FOR_NEXT_TIME", true)) {
                    return kotlin.Unit.a;
                }
                vn.vinfast.chargingkitapi.models.StationSearchFilter stationSearchFilterA = searchChargingStationPayload.getVn() == null ? vn.vinfast.chargingkitapi.models.StationSearchFilter.h.a() : com.vinfast.companion.map.manager.searchchargingstation.vn.VinFastSearchChargingStationManagerKt.b(searchChargingStationPayload.getVn());
                vn.vinfast.chargingkitapi.usecase.SetSettingStationSearchFilter setSettingStationSearchFilter = this.setSettingStationSearchFilter;
                vinFastSearchChargingStationManager$saveSettingIfNeeded$1.n = kotlin.coroutines.jvm.internal.SpillingKt.a(searchChargingStationPayload);
                vinFastSearchChargingStationManager$saveSettingIfNeeded$1.o = kotlin.coroutines.jvm.internal.SpillingKt.a(stationSearchFilterA);
                vinFastSearchChargingStationManager$saveSettingIfNeeded$1.r = 1;
                if (setSettingStationSearchFilter.a(stationSearchFilterA, vinFastSearchChargingStationManager$saveSettingIfNeeded$1) == objG) {
                    return objG;
                }
            } else {
                if (i2 != 1) {
                    throw new java.lang.IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                kotlin.ResultKt.b(obj);
            }
        } catch (java.lang.Exception e) {
            timber.log.Timber.a.a("saveSettingIfNeeded -> error: " + e.getMessage(), new java.lang.Object[0]);
        }
        return kotlin.Unit.a;
    }

    @Override // com.vinfast.companion.map.manager.searchchargingstation.SearchChargingStationManager
    public kotlinx.coroutines.flow.Flow a(com.vinfast.companion.map.manager.searchchargingstation.SearchChargingStationPayload payload) {
        kotlin.jvm.internal.Intrinsics.l(payload, "payload");
        return kotlinx.coroutines.flow.FlowKt.T(kotlinx.coroutines.flow.FlowKt.P(new com.vinfast.companion.map.manager.searchchargingstation.vn.VinFastSearchChargingStationManager$search$1(this, payload, null)), kotlinx.coroutines.Dispatchers.b());
    }

    @Override // com.vinfast.companion.map.manager.searchchargingstation.SearchChargingStationManager
    public /* bridge */ boolean b(com.vinfast.companion.map.model.MapLocationCategory mapLocationCategory) {
        return super.b(mapLocationCategory);
    }
}
