package com.strmr.ps.data.model;

import androidx.media3.container.NalUnitUtil;
import androidx.media3.session.legacy.PlaybackStateCompat;
import defpackage.cr4;
import defpackage.dp4;
import defpackage.fi7;
import defpackage.hn2;
import defpackage.jn2;
import defpackage.kp6;
import defpackage.n89;
import defpackage.pq6;
import defpackage.pw7;
import defpackage.q07;
import defpackage.tp5;
import defpackage.uz1;
import defpackage.vw2;
import defpackage.vx8;
import defpackage.y41;
import defpackage.yw7;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import kotlin.Metadata;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010 \n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\r\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0003\b\u0086\b\u0018\u0000 \u001b2\u00020\u0001:\u0002\u001a\u001bB%\u0012\f\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003\u0012\u0006\u0010\u0005\u001a\u00020\u0004\u0012\u0006\u0010\u0006\u001a\u00020\u0007¢\u0006\u0004\b\b\u0010\tJ\u000f\u0010\u0010\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003HÆ\u0003J\t\u0010\u0011\u001a\u00020\u0004HÆ\u0003J\t\u0010\u0012\u001a\u00020\u0007HÆ\u0003J-\u0010\u0013\u001a\u00020\u00002\u000e\b\u0002\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u00032\b\b\u0002\u0010\u0005\u001a\u00020\u00042\b\b\u0002\u0010\u0006\u001a\u00020\u0007HÆ\u0001J\u0013\u0010\u0014\u001a\u00020\u00152\b\u0010\u0016\u001a\u0004\u0018\u00010\u0001HÖ\u0003J\t\u0010\u0017\u001a\u00020\u0004HÖ\u0001J\t\u0010\u0018\u001a\u00020\u0019HÖ\u0001R\u0017\u0010\u0002\u001a\b\u0012\u0004\u0012\u00020\u00040\u0003¢\u0006\b\n\u0000\u001a\u0004\b\n\u0010\u000bR\u0011\u0010\u0005\u001a\u00020\u0004¢\u0006\b\n\u0000\u001a\u0004\b\f\u0010\rR\u0011\u0010\u0006\u001a\u00020\u0007¢\u0006\b\n\u0000\u001a\u0004\b\u000e\u0010\u000f¨\u0006\u001c"}, d2 = {"Lcom/strmr/ps/data/model/SeasonPackInfo;", "", "seasons", "", "", "estimatedEpisodeCount", "packType", "Lcom/strmr/ps/data/model/SeasonPackInfo$PackType;", "<init>", "(Ljava/util/List;ILcom/strmr/ps/data/model/SeasonPackInfo$PackType;)V", "getSeasons", "()Ljava/util/List;", "getEstimatedEpisodeCount", "()I", "getPackType", "()Lcom/strmr/ps/data/model/SeasonPackInfo$PackType;", "component1", "component2", "component3", "copy", "equals", "", "other", "hashCode", "toString", "", "PackType", "Companion", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
public final /* data */ class SeasonPackInfo {
    private static final int AVG_EPISODES_PER_SEASON = 10;

    /* JADX INFO: renamed from: Companion, reason: from kotlin metadata */
    @kp6
    public static final Companion INSTANCE = new Companion(null);
    private final int estimatedEpisodeCount;

    @kp6
    private final PackType packType;

    @kp6
    private final List<Integer> seasons;

    @Metadata(d1 = {"\u0000.\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\t\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\b\u0086\u0003\u0018\u00002\u00020\u0001B\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003J\u0017\u0010\u0007\u001a\u0004\u0018\u00010\u00062\u0006\u0010\u0005\u001a\u00020\u0004¢\u0006\u0004\b\u0007\u0010\bJ)\u0010\u000e\u001a\u000e\u0012\u0004\u0012\u00020\t\u0012\u0004\u0012\u00020\u00040\r2\u0006\u0010\n\u001a\u00020\t2\u0006\u0010\f\u001a\u00020\u000b¢\u0006\u0004\b\u000e\u0010\u000fR\u0014\u0010\u0010\u001a\u00020\u000b8\u0002X\u0082T¢\u0006\u0006\n\u0004\b\u0010\u0010\u0011¨\u0006\u0012"}, d2 = {"Lcom/strmr/ps/data/model/SeasonPackInfo$Companion;", "", "<init>", "()V", "", "fileName", "Lcom/strmr/ps/data/model/SeasonPackInfo;", "detectFromFileName", "(Ljava/lang/String;)Lcom/strmr/ps/data/model/SeasonPackInfo;", "", "totalBytes", "", "episodeCount", "Lq07;", "estimateEpisodeSize", "(JI)Lq07;", "AVG_EPISODES_PER_SEASON", "I", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    @vx8
    public static final class Companion {
        public /* synthetic */ Companion(uz1 uz1Var) {
            this();
        }

        @pq6
        public final SeasonPackInfo detectFromFileName(@kp6 String fileName) {
            Integer numBe;
            Integer numBe2;
            int iIntValue;
            cr4.g(fileName, "fileName");
            String upperCase = fileName.toUpperCase(Locale.ROOT);
            cr4.f(upperCase, "toUpperCase(...)");
            yw7 yw7Var = yw7.b;
            List listAn = y41.an(new pw7("S\\d{1,2}E\\d{1,2}", yw7Var), new pw7("\\d{1,2}x\\d{1,2}", yw7Var), new pw7("Episode\\s*\\d+", yw7Var));
            if (!(listAn instanceof Collection) || !listAn.isEmpty()) {
                Iterator it = listAn.iterator();
                while (it.hasNext()) {
                    if (((pw7) it.next()).a(fileName)) {
                        return null;
                    }
                }
            }
            yw7 yw7Var2 = yw7.b;
            Iterator it2 = y41.av(y41.an(new pw7("S(\\d{1,2})\\s*[-–]\\s*S(\\d{1,2})(?!\\d)", yw7Var2), new pw7("S(\\d{1,2})\\s+to\\s+S(\\d{1,2})(?!\\d)", yw7Var2)), new pw7("Seasons?\\s*(\\d{1,2})\\s*[-–]\\s*(\\d{1,2})(?![0-9p])", yw7Var2)).iterator();
            while (it2.hasNext()) {
                tp5 tp5VarB = ((pw7) it2.next()).b(fileName);
                if (tp5VarB != null && (numBe2 = n89.be((String) tp5VarB.b().get(1))) != null) {
                    int iIntValue2 = numBe2.intValue();
                    Integer numBe3 = n89.be((String) tp5VarB.b().get(2));
                    if (numBe3 != null && (iIntValue = numBe3.intValue()) >= iIntValue2 && iIntValue <= 20) {
                        List listBo = y41.bo(new dp4(iIntValue2, iIntValue, 1));
                        return new SeasonPackInfo(listBo, listBo.size() * 10, PackType.MULTI_SEASON);
                    }
                }
            }
            yw7 yw7Var3 = yw7.b;
            Iterator it3 = y41.an(new pw7("[.\\s_-]S(\\d{1,2})[.\\s_-](?!E\\d)", yw7Var3), new pw7("[.\\s_-]S(\\d{1,2})(?:\\.(720p|1080p|2160p|Complete|COMPLETE|Full)|\\s*$)", yw7Var3), new pw7("Season[.\\s_-]*(\\d{1,2})", yw7Var3)).iterator();
            while (it3.hasNext()) {
                tp5 tp5VarB2 = ((pw7) it3.next()).b(fileName);
                if (tp5VarB2 != null && (numBe = n89.be((String) tp5VarB2.b().get(1))) != null) {
                    return new SeasonPackInfo(y41.am(numBe), 10, PackType.SINGLE_SEASON);
                }
            }
            List listAn2 = y41.an("COMPLETE", "COMPLETE.SERIES", "COMPLETE SERIES", "ALL.SEASONS", "ALL SEASONS", "SERIES.COMPLETE", "FULL.SERIES", "FULL SERIES", "THE.COMPLETE");
            if ((listAn2 instanceof Collection) && listAn2.isEmpty()) {
                return null;
            }
            Iterator it4 = listAn2.iterator();
            while (it4.hasNext()) {
                if (n89.l(upperCase, (String) it4.next(), false)) {
                    return new SeasonPackInfo(y41.bo(new dp4(1, 5, 1)), 50, PackType.COMPLETE_SERIES);
                }
            }
            return null;
        }

        @kp6
        public final q07<Long, String> estimateEpisodeSize(long totalBytes, int episodeCount) {
            if (episodeCount <= 0 || totalBytes <= 0) {
                return new q07<>(Long.valueOf(totalBytes), "? GB");
            }
            long j = totalBytes / ((long) episodeCount);
            q07 q07Var = j >= 1073741824 ? new q07(String.format("%.2f", Arrays.copyOf(new Object[]{Double.valueOf(j / 1.073741824E9d)}, 1)), "GB") : j >= PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED ? new q07(String.format("%.0f", Arrays.copyOf(new Object[]{Double.valueOf(j / 1048576.0d)}, 1)), "MB") : new q07(String.format("%.0f", Arrays.copyOf(new Object[]{Double.valueOf(j / 1024.0d)}, 1)), "KB");
            return new q07<>(Long.valueOf(j), vw2.l((String) q07Var.a, " ", (String) q07Var.b));
        }

        private Companion() {
        }
    }

    /* JADX WARN: Failed to restore enum class, 'enum' modifier and super class removed */
    /* JADX WARN: Unknown enum class pattern. Please report as an issue! */
    @Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0006\b\u0086\u0081\u0002\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\t\b\u0002¢\u0006\u0004\b\u0002\u0010\u0003j\u0002\b\u0004j\u0002\b\u0005j\u0002\b\u0006¨\u0006\u0007"}, d2 = {"Lcom/strmr/ps/data/model/SeasonPackInfo$PackType;", "", "<init>", "(Ljava/lang/String;I)V", "SINGLE_SEASON", "MULTI_SEASON", "COMPLETE_SERIES", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class PackType {
        private static final /* synthetic */ hn2 $ENTRIES;
        private static final /* synthetic */ PackType[] $VALUES;
        public static final PackType SINGLE_SEASON = new PackType("SINGLE_SEASON", 0);
        public static final PackType MULTI_SEASON = new PackType("MULTI_SEASON", 1);
        public static final PackType COMPLETE_SERIES = new PackType("COMPLETE_SERIES", 2);

        private static final /* synthetic */ PackType[] $values() {
            return new PackType[]{SINGLE_SEASON, MULTI_SEASON, COMPLETE_SERIES};
        }

        static {
            PackType[] packTypeArr$values = $values();
            $VALUES = packTypeArr$values;
            $ENTRIES = jn2.a(packTypeArr$values);
        }

        private PackType(String str, int i) {
        }

        @kp6
        public static hn2<PackType> getEntries() {
            return $ENTRIES;
        }

        public static PackType valueOf(String str) {
            return (PackType) Enum.valueOf(PackType.class, str);
        }

        public static PackType[] values() {
            return (PackType[]) $VALUES.clone();
        }
    }

    public SeasonPackInfo(@kp6 List<Integer> list, int i, @kp6 PackType packType) {
        cr4.g(list, "seasons");
        cr4.g(packType, "packType");
        this.seasons = list;
        this.estimatedEpisodeCount = i;
        this.packType = packType;
    }

    /* JADX WARN: Multi-variable type inference failed */
    public static /* synthetic */ SeasonPackInfo copy$default(SeasonPackInfo seasonPackInfo, List list, int i, PackType packType, int i2, Object obj) {
        if ((i2 & 1) != 0) {
            list = seasonPackInfo.seasons;
        }
        if ((i2 & 2) != 0) {
            i = seasonPackInfo.estimatedEpisodeCount;
        }
        if ((i2 & 4) != 0) {
            packType = seasonPackInfo.packType;
        }
        return seasonPackInfo.copy(list, i, packType);
    }

    @kp6
    public final List<Integer> component1() {
        return this.seasons;
    }

    /* JADX INFO: renamed from: component2, reason: from getter */
    public final int getEstimatedEpisodeCount() {
        return this.estimatedEpisodeCount;
    }

    @kp6
    /* JADX INFO: renamed from: component3, reason: from getter */
    public final PackType getPackType() {
        return this.packType;
    }

    @kp6
    public final SeasonPackInfo copy(@kp6 List<Integer> seasons, int estimatedEpisodeCount, @kp6 PackType packType) {
        cr4.g(seasons, "seasons");
        cr4.g(packType, "packType");
        return new SeasonPackInfo(seasons, estimatedEpisodeCount, packType);
    }

    public boolean equals(@pq6 Object other) {
        if (this == other) {
            return true;
        }
        if (!(other instanceof SeasonPackInfo)) {
            return false;
        }
        SeasonPackInfo seasonPackInfo = (SeasonPackInfo) other;
        return cr4.b(this.seasons, seasonPackInfo.seasons) && this.estimatedEpisodeCount == seasonPackInfo.estimatedEpisodeCount && this.packType == seasonPackInfo.packType;
    }

    public final int getEstimatedEpisodeCount() {
        return this.estimatedEpisodeCount;
    }

    @kp6
    public final PackType getPackType() {
        return this.packType;
    }

    @kp6
    public final List<Integer> getSeasons() {
        return this.seasons;
    }

    public int hashCode() {
        return this.packType.hashCode() + fi7.a(this.estimatedEpisodeCount, this.seasons.hashCode() * 31, 31);
    }

    @kp6
    public String toString() {
        return "SeasonPackInfo(seasons=" + this.seasons + ", estimatedEpisodeCount=" + this.estimatedEpisodeCount + ", packType=" + this.packType + ")";
    }
}
