package com.revenuecat.purchases.ui.revenuecatui.components.video;

import B.H0;
import E3.v;
import G0.InterfaceC0262j;
import androidx.compose.runtime.MutableState;
import androidx.compose.runtime.SnapshotStateKt;
import androidx.compose.runtime.SnapshotStateKt__SnapshotStateKt;
import androidx.compose.runtime.State;
import androidx.compose.runtime.internal.StabilityInferred;
import com.revenuecat.purchases.paywalls.components.properties.ImageUrls;
import com.revenuecat.purchases.paywalls.components.properties.Size;
import com.revenuecat.purchases.paywalls.components.properties.SizeConstraint;
import com.revenuecat.purchases.paywalls.components.properties.ThemeImageUrls;
import com.revenuecat.purchases.paywalls.components.properties.ThemeVideoUrls;
import com.revenuecat.purchases.paywalls.components.properties.VideoUrls;
import com.revenuecat.purchases.ui.revenuecatui.CustomVariableValue;
import com.revenuecat.purchases.ui.revenuecatui.components.PresentedVideoPartial;
import com.revenuecat.purchases.ui.revenuecatui.components.modifier.AspectRatio;
import com.revenuecat.purchases.ui.revenuecatui.components.properties.BorderStyles;
import com.revenuecat.purchases.ui.revenuecatui.components.properties.ColorStyles;
import com.revenuecat.purchases.ui.revenuecatui.components.properties.ShadowStyles;
import com.revenuecat.purchases.ui.revenuecatui.components.state.PackageAwareDelegate;
import com.revenuecat.purchases.ui.revenuecatui.components.style.VideoComponentStyle;
import h1.m;
import java.util.Map;
import kotlin.jvm.internal.h;
import kotlin.jvm.internal.o;
import kotlin.jvm.internal.p;
import n2.AbstractC2612c;
import p0.X;
import x4.z;

/* JADX INFO: loaded from: classes3.dex */
@StabilityInferred(parameters = 0)
public final class VideoComponentState {
    public static final int $stable = 8;
    private final State aspectRatio$delegate;
    private final State border$delegate;
    private final State contentScale$delegate;
    private final J4.a customVariablesProvider;
    private final MutableState darkMode$delegate;
    private final MutableState density$delegate;
    private final State fallbackAspectRatio$delegate;
    private final State fallbackImageUrls$delegate;
    private final State fallbackUrls$delegate;
    private final State imageAspectRatio$delegate;
    private final MutableState layoutDirection$delegate;
    private final J4.a localeProvider;
    private final State margin$delegate;
    private final State marginAdjustedAspectRatio$delegate;
    private final State overlay$delegate;
    private final PackageAwareDelegate packageAwareDelegate;
    private final State padding$delegate;
    private final State presentedPartial$delegate;
    private final J4.a selectedOfferEligibilityProvider;
    private final J4.a selectedPackageInfoProvider;
    private final J4.a selectedTabIndexProvider;
    private final State shadow$delegate;
    private final State shape$delegate;
    private final State size$delegate;
    private final State sizePlusMargin$delegate;
    private final VideoComponentStyle style;
    private final State themeVideoUrls$delegate;
    private final State videoAspectRatio$delegate;
    private final State videoUrls$delegate;
    private final State visible$delegate;
    private final MutableState windowSize$delegate;

    /* JADX INFO: renamed from: com.revenuecat.purchases.ui.revenuecatui.components.video.VideoComponentState$1, reason: invalid class name */
    public static final class AnonymousClass1 extends p implements J4.a {
        public static final AnonymousClass1 INSTANCE = new AnonymousClass1();

        public AnonymousClass1() {
            super(0);
        }

        @Override // J4.a
        public final Map<String, CustomVariableValue> invoke() {
            return z.f26066a;
        }
    }

    public VideoComponentState(A2.c initialWindowSize, h1.c initialDensity, boolean z6, m initialLayoutDirection, VideoComponentStyle style, J4.a localeProvider, J4.a selectedPackageInfoProvider, J4.a selectedTabIndexProvider, J4.a selectedOfferEligibilityProvider, J4.a customVariablesProvider) {
        o.h(initialWindowSize, "initialWindowSize");
        o.h(initialDensity, "initialDensity");
        o.h(initialLayoutDirection, "initialLayoutDirection");
        o.h(style, "style");
        o.h(localeProvider, "localeProvider");
        o.h(selectedPackageInfoProvider, "selectedPackageInfoProvider");
        o.h(selectedTabIndexProvider, "selectedTabIndexProvider");
        o.h(selectedOfferEligibilityProvider, "selectedOfferEligibilityProvider");
        o.h(customVariablesProvider, "customVariablesProvider");
        this.style = style;
        this.localeProvider = localeProvider;
        this.selectedPackageInfoProvider = selectedPackageInfoProvider;
        this.selectedTabIndexProvider = selectedTabIndexProvider;
        this.selectedOfferEligibilityProvider = selectedOfferEligibilityProvider;
        this.customVariablesProvider = customVariablesProvider;
        this.windowSize$delegate = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(initialWindowSize, null, 2, null);
        this.density$delegate = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(initialDensity, null, 2, null);
        this.darkMode$delegate = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(Boolean.valueOf(z6), null, 2, null);
        this.layoutDirection$delegate = SnapshotStateKt__SnapshotStateKt.mutableStateOf$default(initialLayoutDirection, null, 2, null);
        this.packageAwareDelegate = new PackageAwareDelegate(style, selectedPackageInfoProvider, selectedTabIndexProvider, selectedOfferEligibilityProvider);
        this.presentedPartial$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$presentedPartial$2(this));
        this.themeVideoUrls$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$themeVideoUrls$2(this));
        this.fallbackImageUrls$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$fallbackImageUrls$2(this));
        this.visible$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$visible$2(this));
        this.videoUrls$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$videoUrls$2(this));
        this.fallbackUrls$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$fallbackUrls$2(this));
        this.imageAspectRatio$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$imageAspectRatio$2(this));
        this.videoAspectRatio$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$videoAspectRatio$2(this));
        this.size$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$size$2(this));
        this.aspectRatio$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$aspectRatio$2(this));
        this.fallbackAspectRatio$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$fallbackAspectRatio$2(this));
        this.padding$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$padding$2(this));
        this.margin$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$margin$2(this));
        this.sizePlusMargin$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$sizePlusMargin$2(this));
        this.marginAdjustedAspectRatio$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$marginAdjustedAspectRatio$2(this));
        this.shape$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$shape$2(this));
        this.border$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$border$2(this));
        this.shadow$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$shadow$2(this));
        this.overlay$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$overlay$2(this));
        this.contentScale$delegate = SnapshotStateKt.derivedStateOf(new VideoComponentState$contentScale$2(this));
    }

    /* JADX INFO: renamed from: adjustDimension-yOCu0fQ, reason: not valid java name */
    private final SizeConstraint m825adjustDimensionyOCu0fQ(SizeConstraint sizeConstraint, SizeConstraint sizeConstraint2, int i6, int i7, h1.c cVar) {
        if (!(sizeConstraint instanceof SizeConstraint.Fit)) {
            if (sizeConstraint instanceof SizeConstraint.Fill ? true : sizeConstraint instanceof SizeConstraint.Fixed) {
                return sizeConstraint;
            }
            throw new v();
        }
        if (sizeConstraint2 instanceof SizeConstraint.Fit) {
            return new SizeConstraint.Fixed(AbstractC2612c.l(cVar.L(i6)), null);
        }
        if (sizeConstraint2 instanceof SizeConstraint.Fill) {
            return sizeConstraint;
        }
        if (sizeConstraint2 instanceof SizeConstraint.Fixed) {
            return new SizeConstraint.Fixed(AbstractC2612c.l(cVar.N((((float) AbstractC2612c.u(((SizeConstraint.Fixed) sizeConstraint2).m621getValuepVg5ArA())) / cVar.L(i7)) * i6)), null);
        }
        throw new v();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final Size adjustForVideo(Size size, VideoUrls videoUrls, h1.c cVar) {
        return new Size(m825adjustDimensionyOCu0fQ(size.getWidth(), size.getHeight(), videoUrls.m623getWidthpVg5ArA(), videoUrls.m622getHeightpVg5ArA(), cVar), m825adjustDimensionyOCu0fQ(size.getHeight(), size.getWidth(), videoUrls.m622getHeightpVg5ArA(), videoUrls.m623getWidthpVg5ArA(), cVar));
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* JADX WARN: Multi-variable type inference failed */
    public final boolean getDarkMode() {
        return ((Boolean) this.darkMode$delegate.getValue()).booleanValue();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final h1.c getDensity() {
        return (h1.c) this.density$delegate.getValue();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final ThemeImageUrls getFallbackImageUrls() {
        return (ThemeImageUrls) this.fallbackImageUrls$delegate.getValue();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final Float getImageAspectRatio() {
        return (Float) this.imageAspectRatio$delegate.getValue();
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* JADX WARN: Multi-variable type inference failed */
    public final m getLayoutDirection() {
        return (m) this.layoutDirection$delegate.getValue();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final PresentedVideoPartial getPresentedPartial() {
        return (PresentedVideoPartial) this.presentedPartial$delegate.getValue();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final ThemeVideoUrls getThemeVideoUrls() {
        return (ThemeVideoUrls) this.themeVideoUrls$delegate.getValue();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final float getVideoAspectRatio() {
        return ((Number) this.videoAspectRatio$delegate.getValue()).floatValue();
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* JADX WARN: Multi-variable type inference failed */
    public final A2.c getWindowSize() {
        return (A2.c) this.windowSize$delegate.getValue();
    }

    private final void setDarkMode(boolean z6) {
        this.darkMode$delegate.setValue(Boolean.valueOf(z6));
    }

    private final void setDensity(h1.c cVar) {
        this.density$delegate.setValue(cVar);
    }

    private final void setLayoutDirection(m mVar) {
        this.layoutDirection$delegate.setValue(mVar);
    }

    private final void setWindowSize(A2.c cVar) {
        this.windowSize$delegate.setValue(cVar);
    }

    public static /* synthetic */ void update$default(VideoComponentState videoComponentState, A2.c cVar, h1.c cVar2, Boolean bool, m mVar, int i6, Object obj) {
        if ((i6 & 1) != 0) {
            cVar = null;
        }
        if ((i6 & 2) != 0) {
            cVar2 = null;
        }
        if ((i6 & 4) != 0) {
            bool = null;
        }
        if ((i6 & 8) != 0) {
            mVar = null;
        }
        videoComponentState.update(cVar, cVar2, bool, mVar);
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof VideoComponentState)) {
            return false;
        }
        VideoComponentState videoComponentState = (VideoComponentState) obj;
        return o.c(this.style, videoComponentState.style) && o.c(this.localeProvider, videoComponentState.localeProvider) && o.c(this.selectedPackageInfoProvider, videoComponentState.selectedPackageInfoProvider) && o.c(this.selectedTabIndexProvider, videoComponentState.selectedTabIndexProvider) && o.c(this.selectedOfferEligibilityProvider, videoComponentState.selectedOfferEligibilityProvider) && o.c(this.customVariablesProvider, videoComponentState.customVariablesProvider);
    }

    public final /* synthetic */ AspectRatio getAspectRatio() {
        return (AspectRatio) this.aspectRatio$delegate.getValue();
    }

    public final /* synthetic */ BorderStyles getBorder() {
        return (BorderStyles) this.border$delegate.getValue();
    }

    public final /* synthetic */ InterfaceC0262j getContentScale() {
        return (InterfaceC0262j) this.contentScale$delegate.getValue();
    }

    public final /* synthetic */ AspectRatio getFallbackAspectRatio() {
        return (AspectRatio) this.fallbackAspectRatio$delegate.getValue();
    }

    public final /* synthetic */ ImageUrls getFallbackUrls() {
        return (ImageUrls) this.fallbackUrls$delegate.getValue();
    }

    public final /* synthetic */ H0 getMargin() {
        return (H0) this.margin$delegate.getValue();
    }

    public final /* synthetic */ AspectRatio getMarginAdjustedAspectRatio() {
        return (AspectRatio) this.marginAdjustedAspectRatio$delegate.getValue();
    }

    public final /* synthetic */ ColorStyles getOverlay() {
        return (ColorStyles) this.overlay$delegate.getValue();
    }

    public final /* synthetic */ H0 getPadding() {
        return (H0) this.padding$delegate.getValue();
    }

    public final /* synthetic */ ShadowStyles getShadow() {
        return (ShadowStyles) this.shadow$delegate.getValue();
    }

    public final /* synthetic */ X getShape() {
        return (X) this.shape$delegate.getValue();
    }

    public final /* synthetic */ Size getSize() {
        return (Size) this.size$delegate.getValue();
    }

    public final /* synthetic */ Size getSizePlusMargin() {
        return (Size) this.sizePlusMargin$delegate.getValue();
    }

    public final /* synthetic */ VideoUrls getVideoUrls() {
        return (VideoUrls) this.videoUrls$delegate.getValue();
    }

    public final /* synthetic */ boolean getVisible() {
        return ((Boolean) this.visible$delegate.getValue()).booleanValue();
    }

    public int hashCode() {
        return this.customVariablesProvider.hashCode() + ((this.selectedOfferEligibilityProvider.hashCode() + ((this.selectedTabIndexProvider.hashCode() + ((this.selectedPackageInfoProvider.hashCode() + ((this.localeProvider.hashCode() + (this.style.hashCode() * 31)) * 31)) * 31)) * 31)) * 31);
    }

    public String toString() {
        return "VideoComponentState(style=" + this.style + ", localeProvider=" + this.localeProvider + ", selectedPackageInfoProvider=" + this.selectedPackageInfoProvider + ", selectedTabIndexProvider=" + this.selectedTabIndexProvider + ", selectedOfferEligibilityProvider=" + this.selectedOfferEligibilityProvider + ", customVariablesProvider=" + this.customVariablesProvider + ')';
    }

    public final /* synthetic */ void update(A2.c cVar, h1.c cVar2, Boolean bool, m mVar) {
        if (cVar != null) {
            setWindowSize(cVar);
        }
        if (cVar2 != null) {
            setDensity(cVar2);
        }
        if (bool != null) {
            setDarkMode(bool.booleanValue());
        }
        if (mVar != null) {
            setLayoutDirection(mVar);
        }
    }

    public /* synthetic */ VideoComponentState(A2.c cVar, h1.c cVar2, boolean z6, m mVar, VideoComponentStyle videoComponentStyle, J4.a aVar, J4.a aVar2, J4.a aVar3, J4.a aVar4, J4.a aVar5, int i6, h hVar) {
        this(cVar, cVar2, z6, mVar, videoComponentStyle, aVar, aVar2, aVar3, aVar4, (i6 & 512) != 0 ? AnonymousClass1.INSTANCE : aVar5);
    }
}
