package defpackage;

import android.net.Uri;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

/* JADX INFO: renamed from: ᵝʨ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C2906 implements InterfaceC0211 {

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final long f11175;

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final long f11176;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final long f11177;

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public final List f11178;

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final long f11179;

    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public final C2459 f11180;

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public final C0288 f11181;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final long f11182;

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final long f11183;

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public final Uri f11184;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final boolean f11185;

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public final C0946 f11186;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final long f11187;

    public C2906(long j, long j2, long j3, boolean z, long j4, long j5, long j6, long j7, C2459 c2459, C0946 c0946, C0288 c0288, Uri uri, ArrayList arrayList) {
        this.f11182 = j;
        this.f11175 = j2;
        this.f11177 = j3;
        this.f11185 = z;
        this.f11179 = j4;
        this.f11187 = j5;
        this.f11183 = j6;
        this.f11176 = j7;
        this.f11180 = c2459;
        this.f11186 = c0946;
        this.f11184 = uri;
        this.f11181 = c0288;
        this.f11178 = arrayList;
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final C1736 m6970(int i) {
        return (C1736) this.f11178.get(i);
    }

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final long m6971(int i) {
        long j;
        long j2;
        List list = this.f11178;
        if (i == list.size() - 1) {
            j = this.f11175;
            if (j == -9223372036854775807L) {
                return -9223372036854775807L;
            }
            j2 = ((C1736) list.get(i)).f6964;
        } else {
            j = ((C1736) list.get(i + 1)).f6964;
            j2 = ((C1736) list.get(i)).f6964;
        }
        return j - j2;
    }

    @Override // defpackage.InterfaceC0211
    /* JADX INFO: renamed from: ᵲᵶᵳˈ */
    public final Object mo1374(List list) {
        long j;
        LinkedList linkedList = new LinkedList(list);
        Collections.sort(linkedList);
        linkedList.add(new C0170());
        ArrayList arrayList = new ArrayList();
        long j2 = 0;
        int i = 0;
        while (true) {
            if (i >= this.f11178.size()) {
                break;
            }
            if (((C0170) linkedList.peek()).f1590 != i) {
                long jM6971 = m6971(i);
                if (jM6971 != -9223372036854775807L) {
                    j2 += jM6971;
                }
            } else {
                C1736 c1736M6970 = m6970(i);
                List list2 = c1736M6970.f6965;
                C0170 c0170 = (C0170) linkedList.poll();
                int i2 = c0170.f1590;
                ArrayList arrayList2 = new ArrayList();
                while (true) {
                    int i3 = c0170.f1592;
                    C2104 c2104 = (C2104) list2.get(i3);
                    List list3 = c2104.f8364;
                    ArrayList arrayList3 = new ArrayList();
                    do {
                        arrayList3.add((AbstractC0841) list3.get(c0170.f1591));
                        c0170 = (C0170) linkedList.poll();
                        if (c0170.f1590 != i2) {
                            break;
                        }
                    } while (c0170.f1592 == i3);
                    j = j2;
                    arrayList2.add(new C2104(c2104.f8366, c2104.f8363, arrayList3, c2104.f8367, c2104.f8365, c2104.f8368));
                    if (c0170.f1590 != i2) {
                        break;
                    }
                    j2 = j;
                }
                linkedList.addFirst(c0170);
                arrayList.add(new C1736(c1736M6970.f6966, c1736M6970.f6964 - j, arrayList2, c1736M6970.f6967));
                j2 = j;
            }
            i++;
        }
        long j3 = j2;
        long j4 = this.f11175;
        return new C2906(this.f11182, j4 != -9223372036854775807L ? j4 - j3 : -9223372036854775807L, this.f11177, this.f11185, this.f11179, this.f11187, this.f11183, this.f11176, this.f11180, this.f11186, this.f11181, this.f11184, arrayList);
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final long m6972(int i) {
        return AbstractC0956.m3214(m6971(i));
    }
}
