package com.vinfast.companion.main.ui.rsa.global.selectservicelocation;

/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes3.dex */
@dagger.hilt.android.lifecycle.HiltViewModel
@kotlin.Metadata(d1 = {"\u0000j\n\u0002\u0018\u0002\n\u0002\u0018\u0002\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\u0018\u0002\n\u0000\n\u0002\u0010\u0006\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0006\b\u0007\u0018\u00002\u00020\u0001B\u0019\b\u0007\u0012\u0006\u0010\u0003\u001a\u00020\u0002\u0012\u0006\u0010\u0005\u001a\u00020\u0004¢\u0006\u0004\b\u0006\u0010\u0007J\u0017\u0010\u000b\u001a\u00020\n2\u0006\u0010\t\u001a\u00020\bH\u0002¢\u0006\u0004\b\u000b\u0010\fJ)\u0010\u0013\u001a\u00020\n2\b\u0010\u000e\u001a\u0004\u0018\u00010\r2\u0006\u0010\u0010\u001a\u00020\u000f2\b\u0010\u0012\u001a\u0004\u0018\u00010\u0011¢\u0006\u0004\b\u0013\u0010\u0014J#\u0010\u0019\u001a\u00020\n2\u0006\u0010\u0016\u001a\u00020\u00152\f\u0010\u0018\u001a\b\u0012\u0004\u0012\u00020\r0\u0017¢\u0006\u0004\b\u0019\u0010\u001aJ\r\u0010\u001c\u001a\u00020\u001b¢\u0006\u0004\b\u001c\u0010\u001dR\u0014\u0010\u0003\u001a\u00020\u00028\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u001e\u0010\u001fR\u0017\u0010\u0005\u001a\u00020\u00048\u0006¢\u0006\f\n\u0004\b \u0010!\u001a\u0004\b\"\u0010#R \u0010'\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\r0\u00170$8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b%\u0010&R#\u0010-\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\r0\u00170(8\u0006¢\u0006\f\n\u0004\b)\u0010*\u001a\u0004\b+\u0010,R,\u00101\u001a\u001a\u0012\u0016\u0012\u0014\u0012\u0010\u0012\u000e\u0012\u0004\u0012\u00020\r\u0012\u0004\u0012\u00020/0.0\u00170$8\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b0\u0010&R/\u00104\u001a\u001a\u0012\u0016\u0012\u0014\u0012\u0010\u0012\u000e\u0012\u0004\u0012\u00020\r\u0012\u0004\u0012\u00020/0.0\u00170(8\u0006¢\u0006\f\n\u0004\b2\u0010*\u001a\u0004\b3\u0010,¨\u00065"}, d2 = {"Lcom/vinfast/companion/main/ui/rsa/global/selectservicelocation/SelectServiceLocationViewModel;", "Lcom/vinfast/companion/core/base/BaseViewModel;", "Lcom/vinfast/companion/map/manager/HEREManager;", "hereManager", "Lcom/vinfast/companion/corenetwork/manager/remoteConfig/IRemoteConfigManager;", "remoteConfigManager", "<init>", "(Lcom/vinfast/companion/map/manager/HEREManager;Lcom/vinfast/companion/corenetwork/manager/remoteConfig/IRemoteConfigManager;)V", "Lcom/vinfast/companion/map/wrapper/searching/SearchResult;", "searchResult", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "O", "(Lcom/vinfast/companion/map/wrapper/searching/SearchResult;)V", "Lcom/vinfast/companion/map/model/MapLocation;", "center", "Lcom/vinfast/companion/map/model/MapLocationCategory;", "category", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "metersRadius", "Q", "(Lcom/vinfast/companion/map/model/MapLocation;Lcom/vinfast/companion/map/model/MapLocationCategory;Ljava/lang/Double;)V", "Landroid/content/Context;", "context", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "data", "P", "(Landroid/content/Context;Ljava/util/List;)V", "Lcom/vinfast/companion/core/base/ui/widget/dialog/hotline/Hotlines;", "N", "()Lcom/vinfast/companion/core/base/ui/widget/dialog/hotline/Hotlines;", "m", "Lcom/vinfast/companion/map/manager/HEREManager;", "n", "Lcom/vinfast/companion/corenetwork/manager/remoteConfig/IRemoteConfigManager;", "getRemoteConfigManager", "()Lcom/vinfast/companion/corenetwork/manager/remoteConfig/IRemoteConfigManager;", "Landroidx/lifecycle/MutableLiveData;", "o", "Landroidx/lifecycle/MutableLiveData;", "_listServiceFound", "Landroidx/lifecycle/LiveData;", "p", "Landroidx/lifecycle/LiveData;", "M", "()Landroidx/lifecycle/LiveData;", "listServiceFound", "Lkotlin/Pair;", "Lcom/here/sdk/mapview/MapMarker;", "q", "_listMakerService", "r", "L", "listMakerService", "services_release"}, k = 1, mv = {2, 2, 0}, xi = 48)
@kotlin.jvm.internal.SourceDebugExtension
public final class SelectServiceLocationViewModel extends com.vinfast.companion.core.base.BaseViewModel {

    /* JADX INFO: renamed from: m, reason: from kotlin metadata */
    private final com.vinfast.companion.map.manager.HEREManager hereManager;

    /* JADX INFO: renamed from: n, reason: from kotlin metadata */
    private final com.vinfast.companion.corenetwork.manager.remoteConfig.IRemoteConfigManager remoteConfigManager;

    /* JADX INFO: renamed from: o, reason: from kotlin metadata */
    private final androidx.lifecycle.MutableLiveData _listServiceFound;

    /* JADX INFO: renamed from: p, reason: from kotlin metadata */
    private final androidx.lifecycle.LiveData listServiceFound;

    /* JADX INFO: renamed from: q, reason: from kotlin metadata */
    private final androidx.lifecycle.MutableLiveData _listMakerService;

    /* JADX INFO: renamed from: r, reason: from kotlin metadata */
    private final androidx.lifecycle.LiveData listMakerService;

    public SelectServiceLocationViewModel(com.vinfast.companion.map.manager.HEREManager hEREManager, com.vinfast.companion.corenetwork.manager.remoteConfig.IRemoteConfigManager iRemoteConfigManager) {
        kotlin.jvm.internal.Intrinsics.l(hEREManager, "hereManager");
        kotlin.jvm.internal.Intrinsics.l(iRemoteConfigManager, "remoteConfigManager");
        this.hereManager = hEREManager;
        this.remoteConfigManager = iRemoteConfigManager;
        androidx.lifecycle.MutableLiveData mutableLiveData = new androidx.lifecycle.MutableLiveData();
        this._listServiceFound = mutableLiveData;
        this.listServiceFound = mutableLiveData;
        androidx.lifecycle.MutableLiveData mutableLiveData2 = new androidx.lifecycle.MutableLiveData();
        this._listMakerService = mutableLiveData2;
        this.listMakerService = mutableLiveData2;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final void O(com.vinfast.companion.map.wrapper.searching.SearchResult searchResult) {
        if (searchResult.h()) {
            this._listServiceFound.n(kotlin.collections.CollectionsKt.o());
            return;
        }
        java.util.List listE = searchResult.e();
        if (listE != null) {
            this._listServiceFound.n(listE);
        }
    }

    /* JADX INFO: renamed from: L, reason: from getter */
    public final androidx.lifecycle.LiveData getListMakerService() {
        return this.listMakerService;
    }

    /* JADX INFO: renamed from: M, reason: from getter */
    public final androidx.lifecycle.LiveData getListServiceFound() {
        return this.listServiceFound;
    }

    /* JADX INFO: Thrown type has an unknown type hierarchy: kotlin.NoWhenBranchMatchedException */
    public final com.vinfast.companion.core.base.ui.widget.dialog.hotline.Hotlines N() throws kotlin.NoWhenBranchMatchedException {
        java.util.List listO;
        com.vinfast.companion.corenetwork.manager.remoteConfig.IRemoteConfigManager iRemoteConfigManager = this.remoteConfigManager;
        com.vinfast.companion.core.managers.MarketEnum marketEnumC = com.vinfast.companion.core.utils.CAppShared.a.a().c();
        int i = com.vinfast.companion.main.ui.rsa.global.selectservicelocation.SelectServiceLocationViewModel$getVinFastHotline$$inlined$getHotlines$1$wm$RemoteConfigExtensionKt$WhenMappings.a[marketEnumC.ordinal()];
        if (i == 1 || i == 2 || i == 3) {
            java.lang.String defaultCountryTag = marketEnumC.getDefaultCountryTag();
            java.lang.String strR = iRemoteConfigManager.h().R();
            if (strR == null) {
                strR = okhttp3.HttpUrl.FRAGMENT_ENCODE_SET;
            }
            return new com.vinfast.companion.core.base.ui.widget.dialog.hotline.Hotlines(marketEnumC, kotlin.collections.CollectionsKt.e(new com.vinfast.companion.core.base.ui.widget.dialog.hotline.Hotline(defaultCountryTag, strR)));
        }
        if (i != 4 && i != 5) {
            throw new kotlin.NoWhenBranchMatchedException();
        }
        java.util.Map mapS = iRemoteConfigManager.h().S();
        if (mapS != null) {
            listO = new java.util.ArrayList();
            for (java.util.Map.Entry entry : mapS.entrySet()) {
                java.lang.String str = (java.lang.String) entry.getKey();
                java.lang.String str2 = (java.lang.String) entry.getValue();
                com.vinfast.companion.core.base.ui.widget.dialog.hotline.Hotline hotline = str2 == null ? null : new com.vinfast.companion.core.base.ui.widget.dialog.hotline.Hotline(str, str2);
                if (hotline != null) {
                    listO.add(hotline);
                }
            }
        } else {
            listO = kotlin.collections.CollectionsKt.o();
        }
        return new com.vinfast.companion.core.base.ui.widget.dialog.hotline.Hotlines(marketEnumC, listO);
    }

    public final void P(android.content.Context context, java.util.List data) {
        kotlin.jvm.internal.Intrinsics.l(context, "context");
        kotlin.jvm.internal.Intrinsics.l(data, "data");
        java.util.ArrayList arrayList = new java.util.ArrayList();
        java.util.Iterator it = data.iterator();
        while (it.hasNext()) {
            com.vinfast.companion.map.model.MapLocation mapLocation = (com.vinfast.companion.map.model.MapLocation) it.next();
            android.content.Context context2 = context;
            com.here.sdk.mapview.MapMarker mapMarkerF = com.vinfast.companion.map.MapUtils.f(com.vinfast.companion.map.MapUtils.a, context2, mapLocation, java.lang.Integer.valueOf(com.vinfast.companion.map.R.drawable.ic_map_service_center), (com.here.sdk.core.Anchor2D) null, 8, (java.lang.Object) null);
            if (mapMarkerF != null) {
                arrayList.add(new kotlin.Pair(mapLocation, mapMarkerF));
            }
            context = context2;
        }
        this._listMakerService.n(arrayList);
    }

    public final void Q(com.vinfast.companion.map.model.MapLocation center, com.vinfast.companion.map.model.MapLocationCategory category, java.lang.Double metersRadius) {
        kotlin.jvm.internal.Intrinsics.l(category, "category");
        io.reactivex.rxjava3.core.Single singleK = com.vinfast.companion.map.extensions.SearchEngineExtensionsKt.D(this.hereManager.c(), center != null ? center.l() : null, category, 0, metersRadius, (java.lang.String) null, 20, (java.lang.Object) null).m(new io.reactivex.rxjava3.functions.Consumer() { // from class: com.vinfast.companion.main.ui.rsa.global.selectservicelocation.SelectServiceLocationViewModel$searchMapLocationByCategory$1
            /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
            public final void accept(com.vinfast.companion.map.wrapper.searching.SearchResult searchResult) {
                kotlin.jvm.internal.Intrinsics.l(searchResult, "result");
                this.a.O(searchResult);
            }
        }).k(new io.reactivex.rxjava3.functions.Consumer() { // from class: com.vinfast.companion.main.ui.rsa.global.selectservicelocation.SelectServiceLocationViewModel$searchMapLocationByCategory$2
            /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
            public final void accept(java.lang.Throwable th) {
                kotlin.jvm.internal.Intrinsics.l(th, "it");
                timber.log.Timber.a.d(th);
                this.a._listServiceFound.n(kotlin.collections.CollectionsKt.o());
            }
        });
        kotlin.jvm.internal.Intrinsics.k(singleK, "doOnError(...)");
        com.vinfast.companion.core.base.BaseViewModel.E(this, singleK, (com.vinfast.companion.core.base.ProgressType) null, (kotlin.jvm.functions.Function1) null, 6, (java.lang.Object) null);
    }
}
