package p138.p176.p177.p190.p217.p220.p221;

import android.net.Uri;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import p138.p176.p177.p190.C3414;
import p138.p176.p177.p190.p216.C3777;
import p138.p176.p177.p190.p216.InterfaceC3775;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ໞ.ޞ.އ.ؠ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C3870 implements InterfaceC3775<C3870> {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final long f11963;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final long f11964;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final long f11965;

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final boolean f11966;

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public final long f11967;

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final long f11968;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final long f11969;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final long f11970;

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final C3890 f11971;

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public final Uri f11972;

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public final C3876 f11973;

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public final List<C3875> f11974;

    public C3870(long j, long j2, long j3, boolean z, long j4, long j5, long j6, long j7, C3876 c3876, C3890 c3890, Uri uri, List<C3875> list) {
        this.f11963 = j;
        this.f11964 = j2;
        this.f11965 = j3;
        this.f11966 = z;
        this.f11967 = j4;
        this.f11968 = j5;
        this.f11969 = j6;
        this.f11970 = j7;
        this.f11973 = c3876;
        this.f11971 = c3890;
        this.f11972 = uri;
        this.f11974 = list == null ? Collections.emptyList() : list;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final int m6262() {
        return this.f11974.size();
    }

    @Override // p138.p176.p177.p190.p216.InterfaceC3775
    /* JADX INFO: renamed from: ֏ */
    public C3870 mo6095(List list) {
        LinkedList linkedList = new LinkedList(list);
        Collections.sort(linkedList);
        linkedList.add(new C3777(-1, -1, -1));
        ArrayList arrayList = new ArrayList();
        long j = 0;
        int i = 0;
        while (true) {
            if (i >= m6262()) {
                break;
            }
            if (((C3777) linkedList.peek()).f11570 != i) {
                long jM6264 = m6264(i);
                if (jM6264 != -9223372036854775807L) {
                    j += jM6264;
                }
            } else {
                C3875 c3875M6263 = m6263(i);
                List<C3869> list2 = c3875M6263.f11995;
                C3777 c3777 = (C3777) linkedList.poll();
                int i2 = c3777.f11570;
                ArrayList arrayList2 = new ArrayList();
                while (true) {
                    int i3 = c3777.f11571;
                    C3869 c3869 = list2.get(i3);
                    List<AbstractC3878> list3 = c3869.f11960;
                    ArrayList arrayList3 = new ArrayList();
                    do {
                        arrayList3.add(list3.get(c3777.f11572));
                        c3777 = (C3777) linkedList.poll();
                        if (c3777.f11570 != i2) {
                            break;
                        }
                    } while (c3777.f11571 == i3);
                    List<C3869> list4 = list2;
                    arrayList2.add(new C3869(c3869.f11958, c3869.f11959, arrayList3, c3869.f11961, c3869.f11962));
                    if (c3777.f11570 != i2) {
                        break;
                    }
                    list2 = list4;
                }
                linkedList.addFirst(c3777);
                arrayList.add(new C3875(c3875M6263.f11993, c3875M6263.f11994 - j, arrayList2, c3875M6263.f11996));
            }
            i++;
        }
        long j2 = this.f11964;
        return new C3870(this.f11963, j2 != -9223372036854775807L ? j2 - j : -9223372036854775807L, this.f11965, this.f11966, this.f11967, this.f11968, this.f11969, this.f11970, this.f11973, this.f11971, this.f11972, arrayList);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final C3875 m6263(int i) {
        return this.f11974.get(i);
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final long m6264(int i) {
        if (i != this.f11974.size() - 1) {
            return this.f11974.get(i + 1).f11994 - this.f11974.get(i).f11994;
        }
        long j = this.f11964;
        if (j == -9223372036854775807L) {
            return -9223372036854775807L;
        }
        return j - this.f11974.get(i).f11994;
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final long m6265(int i) {
        return C3414.m5458(m6264(i));
    }
}
