package com.revenuecat.purchases.ui.revenuecatui.views;

import C0.B;
import X0.L;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.util.AttributeSet;
import androidx.compose.runtime.internal.StabilityInferred;
import com.revenuecat.purchases.ui.revenuecatui.R;
import com.revenuecat.purchases.ui.revenuecatui.fonts.CustomFontProvider;
import com.revenuecat.purchases.ui.revenuecatui.fonts.FontProvider;
import com.revenuecat.purchases.ui.revenuecatui.helpers.Logger;
import java.util.Map;
import kotlin.jvm.internal.h;
import kotlin.jvm.internal.o;
import w4.k;
import x4.AbstractC3229F;
import y1.j;

/* JADX INFO: loaded from: classes3.dex */
@StabilityInferred(parameters = 1)
public final class PaywallViewAttributesReader {
    public static final int $stable = 0;
    public static final Companion Companion = new Companion(null);
    public static final boolean DEFAULT_CONDENSED = false;
    private static final Map<int[], Map<Companion.Attributes, Integer>> styleablesByStyleSet;

    public static final class Companion {

        public enum Attributes {
            OfferingId,
            ShouldDisplayDismissButton,
            FontFamily
        }

        public /* synthetic */ Companion(h hVar) {
            this();
        }

        /* JADX WARN: Removed duplicated region for block: B:26:0x0076  */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public final PaywallViewAttributes parseAttributes(Context context, AttributeSet attributeSet, int[] styleAttrs) {
            Boolean boolValueOf;
            o.h(context, "context");
            o.h(styleAttrs, "styleAttrs");
            CustomFontProvider customFontProvider = null;
            if (attributeSet == null) {
                return null;
            }
            TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, styleAttrs, 0, 0);
            try {
                Map map = (Map) PaywallViewAttributesReader.styleablesByStyleSet.get(styleAttrs);
                if (map == null) {
                    Logger.INSTANCE.e("Styleable not found for PaywallView");
                    return null;
                }
                Integer num = (Integer) map.get(Attributes.FontFamily);
                Integer numValueOf = num != null ? Integer.valueOf(typedArrayObtainStyledAttributes.getResourceId(num.intValue(), 0)) : null;
                Integer num2 = (Integer) map.get(Attributes.OfferingId);
                String string = num2 != null ? typedArrayObtainStyledAttributes.getString(num2.intValue()) : null;
                Integer num3 = (Integer) map.get(Attributes.ShouldDisplayDismissButton);
                if (num3 != null) {
                    int iIntValue = num3.intValue();
                    boolValueOf = typedArrayObtainStyledAttributes.hasValue(iIntValue) ? Boolean.valueOf(typedArrayObtainStyledAttributes.getBoolean(iIntValue, false)) : null;
                }
                Boolean boolValueOf2 = typedArrayObtainStyledAttributes.hasValue(R.styleable.PaywallFooterView_condensed) ? Boolean.valueOf(typedArrayObtainStyledAttributes.getBoolean(R.styleable.PaywallFooterView_condensed, false)) : null;
                if (numValueOf != null) {
                    if (numValueOf.intValue() <= 0) {
                        numValueOf = null;
                    }
                    if (numValueOf != null) {
                        Typeface typefaceA = j.a(context, numValueOf.intValue());
                        if (typefaceA == null) {
                            Logger.INSTANCE.e("Font given for PaywallView not found");
                        } else {
                            customFontProvider = new CustomFontProvider(new L(new B(typefaceA, 26)));
                        }
                    }
                }
                return new PaywallViewAttributes(string, customFontProvider, boolValueOf, boolValueOf2);
            } finally {
                typedArrayObtainStyledAttributes.recycle();
            }
        }

        private Companion() {
        }
    }

    @StabilityInferred(parameters = 0)
    public static final class PaywallViewAttributes {
        public static final int $stable = 8;
        private final Boolean condensed;
        private final FontProvider fontProvider;
        private final String offeringId;
        private final Boolean shouldDisplayDismissButton;

        public PaywallViewAttributes(String str, FontProvider fontProvider, Boolean bool, Boolean bool2) {
            this.offeringId = str;
            this.fontProvider = fontProvider;
            this.shouldDisplayDismissButton = bool;
            this.condensed = bool2;
        }

        public static /* synthetic */ PaywallViewAttributes copy$default(PaywallViewAttributes paywallViewAttributes, String str, FontProvider fontProvider, Boolean bool, Boolean bool2, int i6, Object obj) {
            if ((i6 & 1) != 0) {
                str = paywallViewAttributes.offeringId;
            }
            if ((i6 & 2) != 0) {
                fontProvider = paywallViewAttributes.fontProvider;
            }
            if ((i6 & 4) != 0) {
                bool = paywallViewAttributes.shouldDisplayDismissButton;
            }
            if ((i6 & 8) != 0) {
                bool2 = paywallViewAttributes.condensed;
            }
            return paywallViewAttributes.copy(str, fontProvider, bool, bool2);
        }

        public final String component1() {
            return this.offeringId;
        }

        public final FontProvider component2() {
            return this.fontProvider;
        }

        public final Boolean component3() {
            return this.shouldDisplayDismissButton;
        }

        public final Boolean component4() {
            return this.condensed;
        }

        public final PaywallViewAttributes copy(String str, FontProvider fontProvider, Boolean bool, Boolean bool2) {
            return new PaywallViewAttributes(str, fontProvider, bool, bool2);
        }

        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (!(obj instanceof PaywallViewAttributes)) {
                return false;
            }
            PaywallViewAttributes paywallViewAttributes = (PaywallViewAttributes) obj;
            return o.c(this.offeringId, paywallViewAttributes.offeringId) && o.c(this.fontProvider, paywallViewAttributes.fontProvider) && o.c(this.shouldDisplayDismissButton, paywallViewAttributes.shouldDisplayDismissButton) && o.c(this.condensed, paywallViewAttributes.condensed);
        }

        public final Boolean getCondensed() {
            return this.condensed;
        }

        public final FontProvider getFontProvider() {
            return this.fontProvider;
        }

        public final String getOfferingId() {
            return this.offeringId;
        }

        public final Boolean getShouldDisplayDismissButton() {
            return this.shouldDisplayDismissButton;
        }

        public int hashCode() {
            String str = this.offeringId;
            int iHashCode = (str == null ? 0 : str.hashCode()) * 31;
            FontProvider fontProvider = this.fontProvider;
            int iHashCode2 = (iHashCode + (fontProvider == null ? 0 : fontProvider.hashCode())) * 31;
            Boolean bool = this.shouldDisplayDismissButton;
            int iHashCode3 = (iHashCode2 + (bool == null ? 0 : bool.hashCode())) * 31;
            Boolean bool2 = this.condensed;
            return iHashCode3 + (bool2 != null ? bool2.hashCode() : 0);
        }

        public String toString() {
            return "PaywallViewAttributes(offeringId=" + this.offeringId + ", fontProvider=" + this.fontProvider + ", shouldDisplayDismissButton=" + this.shouldDisplayDismissButton + ", condensed=" + this.condensed + ')';
        }
    }

    static {
        int[] iArr = R.styleable.PaywallView;
        Companion.Attributes attributes = Companion.Attributes.OfferingId;
        k kVar = new k(attributes, Integer.valueOf(R.styleable.PaywallView_offeringIdentifier));
        k kVar2 = new k(Companion.Attributes.ShouldDisplayDismissButton, Integer.valueOf(R.styleable.PaywallView_shouldDisplayDismissButton));
        Companion.Attributes attributes2 = Companion.Attributes.FontFamily;
        styleablesByStyleSet = AbstractC3229F.w(new k(iArr, AbstractC3229F.w(kVar, kVar2, new k(attributes2, Integer.valueOf(R.styleable.PaywallView_android_fontFamily)))), new k(R.styleable.PaywallFooterView, AbstractC3229F.w(new k(attributes, Integer.valueOf(R.styleable.PaywallFooterView_offeringIdentifier)), new k(attributes2, Integer.valueOf(R.styleable.PaywallFooterView_android_fontFamily)))));
    }
}
