package O0;

import C3.AbstractC0062y;
import C3.U;
import C3.V;
import C3.W;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.text.TextUtils;
import java.util.Objects;
import u0.C1579o;
import u0.T;

/* JADX INFO: loaded from: classes.dex */
public final class g extends o implements Comparable {

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    public final int f4829A;

    /* JADX INFO: renamed from: B, reason: collision with root package name */
    public final int f4830B;

    /* JADX INFO: renamed from: C, reason: collision with root package name */
    public final boolean f4831C;
    public final boolean D;

    /* JADX INFO: renamed from: E, reason: collision with root package name */
    public final int f4832E;

    /* JADX INFO: renamed from: F, reason: collision with root package name */
    public final int f4833F;

    /* JADX INFO: renamed from: G, reason: collision with root package name */
    public final boolean f4834G;
    public final int H;

    /* JADX INFO: renamed from: I, reason: collision with root package name */
    public final int f4835I;

    /* JADX INFO: renamed from: J, reason: collision with root package name */
    public final int f4836J;

    /* JADX INFO: renamed from: K, reason: collision with root package name */
    public final int f4837K;

    /* JADX INFO: renamed from: L, reason: collision with root package name */
    public final boolean f4838L;

    /* JADX INFO: renamed from: M, reason: collision with root package name */
    public final boolean f4839M;

    /* JADX INFO: renamed from: N, reason: collision with root package name */
    public final boolean f4840N;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final int f4841u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final boolean f4842v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public final String f4843w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public final k f4844x;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public final boolean f4845y;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public final int f4846z;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    /* JADX WARN: Removed duplicated region for block: B:49:0x00a6  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public g(int i, T t6, int i5, k kVar, int i8, boolean z8, f fVar, int i9) {
        int i10;
        int iB;
        boolean z9;
        int iB2;
        boolean z10;
        super(i, t6, i5);
        int i11 = 2;
        this.f4844x = kVar;
        int i12 = kVar.f4866x ? 24 : 16;
        this.f4831C = false;
        this.f4843w = q.e(this.f4882t.f17349d);
        this.f4845y = I1.a.g(i8, false);
        int i13 = 0;
        while (true) {
            W w4 = kVar.f17236k;
            i10 = Integer.MAX_VALUE;
            if (i13 >= w4.f1227t) {
                iB = 0;
                i13 = Integer.MAX_VALUE;
                break;
            } else {
                iB = q.b(this.f4882t, (String) w4.get(i13), false);
                if (iB > 0) {
                    break;
                } else {
                    i13++;
                }
            }
        }
        this.f4829A = i13;
        this.f4846z = iB;
        int i14 = this.f4882t.f17351f;
        this.f4830B = (i14 == 0 || i14 != 0) ? Integer.bitCount(0) : Integer.MAX_VALUE;
        C1579o c1579o = this.f4882t;
        int i15 = c1579o.f17351f;
        this.D = i15 == 0 || (i15 & 1) != 0;
        this.f4834G = (c1579o.f17350e & 1) != 0;
        String str = c1579o.f17358n;
        if (str != null) {
            switch (str) {
                case "audio/eac3-joc":
                case "audio/ac4":
                case "audio/iamf":
                    z9 = true;
                    break;
            }
        } else {
            z9 = false;
        }
        this.f4840N = z9;
        int i16 = c1579o.D;
        this.H = i16;
        this.f4835I = c1579o.f17337E;
        int i17 = c1579o.f17354j;
        this.f4836J = i17;
        this.f4842v = (i17 == -1 || i17 <= kVar.f17238m) && (i16 == -1 || i16 <= kVar.f17237l) && fVar.apply(c1579o);
        Configuration configuration = Resources.getSystem().getConfiguration();
        String[] strArrSplit = x0.v.f18553a >= 24 ? configuration.getLocales().toLanguageTags().split(",", -1) : new String[]{configuration.locale.toLanguageTag()};
        for (int i18 = 0; i18 < strArrSplit.length; i18++) {
            strArrSplit[i18] = x0.v.M(strArrSplit[i18]);
        }
        int i19 = 0;
        while (true) {
            if (i19 < strArrSplit.length) {
                iB2 = q.b(this.f4882t, strArrSplit[i19], false);
                if (iB2 <= 0) {
                    i19++;
                }
            } else {
                iB2 = 0;
                i19 = Integer.MAX_VALUE;
            }
        }
        this.f4832E = i19;
        this.f4833F = iB2;
        int i20 = 0;
        while (true) {
            W w6 = kVar.f17239n;
            if (i20 < w6.f1227t) {
                String str2 = this.f4882t.f17358n;
                if (str2 == null || !str2.equals(w6.get(i20))) {
                    i20++;
                } else {
                    i10 = i20;
                }
            }
        }
        this.f4837K = i10;
        this.f4838L = (i8 & 384) == 128;
        this.f4839M = (i8 & 64) == 64;
        k kVar2 = this.f4844x;
        if (I1.a.g(i8, kVar2.f4868z) && ((z10 = this.f4842v) || kVar2.f4865w)) {
            kVar2.f17240o.getClass();
            if (!I1.a.g(i8, false) || !z10 || this.f4882t.f17354j == -1 || ((!kVar2.f4860A && z8) || (i12 & i8) == 0)) {
                i11 = 1;
            }
        } else {
            i11 = 0;
        }
        this.f4841u = i11;
    }

    @Override // O0.o
    public final int a() {
        return this.f4841u;
    }

    @Override // O0.o
    public final boolean b(o oVar) {
        int i;
        String str;
        g gVar = (g) oVar;
        this.f4844x.getClass();
        C1579o c1579o = this.f4882t;
        int i5 = c1579o.D;
        if (i5 == -1) {
            return false;
        }
        C1579o c1579o2 = gVar.f4882t;
        if (i5 != c1579o2.D) {
            return false;
        }
        if ((this.f4831C || ((str = c1579o.f17358n) != null && TextUtils.equals(str, c1579o2.f17358n))) && (i = c1579o.f17337E) != -1 && i == c1579o2.f17337E) {
            return this.f4838L == gVar.f4838L && this.f4839M == gVar.f4839M;
        }
        return false;
    }

    @Override // java.lang.Comparable
    /* JADX INFO: renamed from: c, reason: merged with bridge method [inline-methods] */
    public final int compareTo(g gVar) {
        boolean z8 = this.f4845y;
        boolean z9 = this.f4842v;
        V vA = (z9 && z8) ? q.i : q.i.a();
        AbstractC0062y abstractC0062yC = AbstractC0062y.f1316a.c(z8, gVar.f4845y);
        Integer numValueOf = Integer.valueOf(this.f4829A);
        Integer numValueOf2 = Integer.valueOf(gVar.f4829A);
        U u8 = U.f1223s;
        AbstractC0062y abstractC0062yB = abstractC0062yC.b(numValueOf, numValueOf2, u8).a(this.f4846z, gVar.f4846z).a(this.f4830B, gVar.f4830B).c(this.f4834G, gVar.f4834G).c(this.D, gVar.D).b(Integer.valueOf(this.f4832E), Integer.valueOf(gVar.f4832E), u8).a(this.f4833F, gVar.f4833F).c(z9, gVar.f4842v).b(Integer.valueOf(this.f4837K), Integer.valueOf(gVar.f4837K), u8);
        this.f4844x.getClass();
        AbstractC0062y abstractC0062yB2 = abstractC0062yB.c(this.f4838L, gVar.f4838L).c(this.f4839M, gVar.f4839M).c(this.f4840N, gVar.f4840N).b(Integer.valueOf(this.H), Integer.valueOf(gVar.H), vA).b(Integer.valueOf(this.f4835I), Integer.valueOf(gVar.f4835I), vA);
        if (Objects.equals(this.f4843w, gVar.f4843w)) {
            abstractC0062yB2 = abstractC0062yB2.b(Integer.valueOf(this.f4836J), Integer.valueOf(gVar.f4836J), vA);
        }
        return abstractC0062yB2.e();
    }
}
