package com.revenuecat.purchases.ui.revenuecatui.data.testdata;

import S4.w;
import X0.AbstractC0808v;
import android.content.res.AssetManager;
import androidx.compose.runtime.internal.StabilityInferred;
import com.revenuecat.purchases.UiConfig;
import com.revenuecat.purchases.paywalls.DownloadedFontFamily;
import com.revenuecat.purchases.ui.revenuecatui.R;
import com.revenuecat.purchases.ui.revenuecatui.helpers.ResourceProvider;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import kotlin.jvm.internal.h;
import kotlin.jvm.internal.o;
import x4.AbstractC3229F;
import x4.AbstractC3253s;
import x4.y;
import x4.z;

/* JADX INFO: loaded from: classes3.dex */
@StabilityInferred(parameters = 0)
public final class MockResourceProvider implements ResourceProvider {
    public static final int $stable = 8;
    private final List<String> assetPaths;
    private final Map<String, DownloadedFontFamily> downloadedFilesByUrl;
    private final Map<Integer, AbstractC0808v> fontFamiliesByXmlResourceId;
    private final AssetManager mockAssetManager;
    private final Map<String, Map<String, Integer>> resourceIds;

    public MockResourceProvider() {
        this(null, null, null, null, null, 31, null);
    }

    @Override // com.revenuecat.purchases.ui.revenuecatui.helpers.ResourceProvider
    public String getApplicationName() {
        return "Mock Paywall";
    }

    @Override // com.revenuecat.purchases.ui.revenuecatui.helpers.ResourceProvider
    public Map<String, String> getAssetFontPaths(List<String> names) {
        o.h(names, "names");
        int iU = AbstractC3229F.u(AbstractC3253s.G(names, 10));
        if (iU < 16) {
            iU = 16;
        }
        LinkedHashMap linkedHashMap = new LinkedHashMap(iU);
        for (Object obj : names) {
            String strConcat = (String) obj;
            if (!w.s0(strConcat, ".ttf", false)) {
                strConcat = strConcat.concat(".ttf");
            }
            linkedHashMap.put(obj, "fonts/" + strConcat);
        }
        LinkedHashMap linkedHashMap2 = new LinkedHashMap();
        for (Map.Entry entry : linkedHashMap.entrySet()) {
            if (this.assetPaths.contains(entry.getValue())) {
                linkedHashMap2.put(entry.getKey(), entry.getValue());
            }
        }
        return linkedHashMap2;
    }

    @Override // com.revenuecat.purchases.ui.revenuecatui.helpers.ResourceProvider
    public AssetManager getAssetManager() {
        return this.mockAssetManager;
    }

    @Override // com.revenuecat.purchases.ui.revenuecatui.helpers.ResourceProvider
    public DownloadedFontFamily getCachedFontFamilyOrStartDownload(UiConfig.AppConfig.FontsConfig.FontInfo.Name fontInfo) {
        o.h(fontInfo, "fontInfo");
        return this.downloadedFilesByUrl.get(fontInfo.getUrl());
    }

    @Override // com.revenuecat.purchases.ui.revenuecatui.helpers.ResourceProvider
    public Locale getLocale() {
        Locale locale = Locale.getDefault();
        o.g(locale, "getDefault()");
        return locale;
    }

    @Override // com.revenuecat.purchases.ui.revenuecatui.helpers.ResourceProvider
    public int getResourceIdentifier(String name, String type) {
        Integer num;
        o.h(name, "name");
        o.h(type, "type");
        Map<String, Integer> map = this.resourceIds.get(type);
        if (map == null || (num = map.get(name)) == null) {
            return 0;
        }
        return num.intValue();
    }

    @Override // com.revenuecat.purchases.ui.revenuecatui.helpers.ResourceProvider
    public String getString(int i6, Object... formatArgs) {
        o.h(formatArgs, "formatArgs");
        if (i6 == R.string.restore_purchases) {
            return "Restore purchases";
        }
        if (i6 == R.string.annual) {
            return "Annual";
        }
        if (i6 == R.string.semester) {
            return "6 month";
        }
        if (i6 == R.string.quarter) {
            return "3 month";
        }
        if (i6 == R.string.bimonthly) {
            return "2 month";
        }
        if (i6 == R.string.monthly) {
            return "Monthly";
        }
        if (i6 == R.string.weekly) {
            return "Weekly";
        }
        if (i6 == R.string.lifetime) {
            return "Lifetime";
        }
        if (i6 == R.string.continue_cta) {
            return "Continue";
        }
        if (i6 == R.string.default_offer_details_with_intro_offer) {
            return "Start your {{ sub_offer_duration }} trial, then {{ total_price_and_per_month }}.";
        }
        if (i6 != R.string.package_discount) {
            throw new IllegalStateException(("Unknown string resource " + i6).toString());
        }
        return formatArgs[0] + "% off";
    }

    @Override // com.revenuecat.purchases.ui.revenuecatui.helpers.ResourceProvider
    public AbstractC0808v getXmlFontFamily(int i6) {
        return this.fontFamiliesByXmlResourceId.get(Integer.valueOf(i6));
    }

    /* JADX WARN: Multi-variable type inference failed */
    public MockResourceProvider(Map<String, ? extends Map<String, Integer>> resourceIds, List<String> assetPaths, Map<String, DownloadedFontFamily> downloadedFilesByUrl, Map<Integer, ? extends AbstractC0808v> fontFamiliesByXmlResourceId, AssetManager assetManager) {
        o.h(resourceIds, "resourceIds");
        o.h(assetPaths, "assetPaths");
        o.h(downloadedFilesByUrl, "downloadedFilesByUrl");
        o.h(fontFamiliesByXmlResourceId, "fontFamiliesByXmlResourceId");
        this.resourceIds = resourceIds;
        this.assetPaths = assetPaths;
        this.downloadedFilesByUrl = downloadedFilesByUrl;
        this.fontFamiliesByXmlResourceId = fontFamiliesByXmlResourceId;
        this.mockAssetManager = assetManager;
    }

    /* JADX WARN: Illegal instructions before constructor call */
    public /* synthetic */ MockResourceProvider(Map map, List list, Map map2, Map map3, AssetManager assetManager, int i6, h hVar) {
        int i7 = i6 & 1;
        z zVar = z.f26066a;
        this(i7 != 0 ? zVar : map, (i6 & 2) != 0 ? y.f26065a : list, (i6 & 4) != 0 ? zVar : map2, (i6 & 8) != 0 ? zVar : map3, (i6 & 16) != 0 ? null : assetManager);
    }
}
