package defpackage;

import android.net.Uri;
import android.os.SystemClock;
import androidx.media3.exoplayer.source.BehindLiveWindowException;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/* JADX INFO: renamed from: ᵺᵺᵾ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C5163 implements InterfaceC0968 {

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

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public BehindLiveWindowException f19402;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final C3511[] f19403;

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public InterfaceC2380 f19404;

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

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public int f19406;

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

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public C0464 f19408;

    public C5163(InterfaceC3244 interfaceC3244, C0464 c0464, int i, InterfaceC2380 interfaceC2380, InterfaceC1070 interfaceC1070, ᵱᵻᵧᵷ r30, boolean z) {
        C3655[] c3655Arr;
        this.f19405 = interfaceC3244;
        this.f19408 = c0464;
        this.f19401 = i;
        this.f19404 = interfaceC2380;
        this.f19407 = interfaceC1070;
        C5494 c5494 = c0464.f2552[i];
        this.f19403 = new C3511[interfaceC2380.length()];
        for (int i2 = 0; i2 < this.f19403.length; i2++) {
            int iMo3741 = interfaceC2380.mo3741(i2);
            C5286 c5286 = c5494.f20766[iMo3741];
            if (c5286.f19965 != null) {
                C4733 c4733 = c0464.f2548;
                c4733.getClass();
                c3655Arr = c4733.f17994;
            } else {
                c3655Arr = null;
            }
            C3655[] c3655Arr2 = c3655Arr;
            int i3 = c5494.f20767;
            int i4 = i3 == 2 ? 4 : 0;
            long j = c5494.f20760;
            long j2 = c0464.f2550;
            this.f19403[i2] = new C3511(new C4461(r30, !z ? 35 : 3, null, new C2476(iMo3741, i3, j, -9223372036854775807L, j2, j2, c5286, 0, c3655Arr2, i4, null, null), C2598.f10048, null), c5494.f20767, c5286);
        }
    }

    @Override // defpackage.InterfaceC0968
    /* JADX INFO: renamed from: ʽˈˋ */
    public final void mo3281() throws BehindLiveWindowException {
        BehindLiveWindowException behindLiveWindowException = this.f19402;
        if (behindLiveWindowException != null) {
            throw behindLiveWindowException;
        }
        this.f19405.mo7395();
    }

    @Override // defpackage.InterfaceC0968
    /* JADX INFO: renamed from: ˊᵫᵗ */
    public final int mo3282(long j, List list) {
        return (this.f19402 != null || this.f19404.length() < 2) ? list.size() : this.f19404.mo3743(j, list);
    }

    @Override // defpackage.InterfaceC0968
    /* JADX INFO: renamed from: ːˏᵟᵯ */
    public final long mo3283(long j, C3318 c3318) {
        C5494 c5494 = this.f19408.f2552[this.f19401];
        int iM3271 = AbstractC0956.m3271(c5494.f20764, j, true);
        long[] jArr = c5494.f20764;
        long j2 = jArr[iM3271];
        return c3318.m7597(j, j2, (j2 >= j || iM3271 >= c5494.f20769 - 1) ? j2 : jArr[iM3271 + 1]);
    }

    @Override // defpackage.InterfaceC0968
    /* JADX INFO: renamed from: ᵨᵣ */
    public final void mo3284(AbstractC1900 abstractC1900) {
    }

    @Override // defpackage.InterfaceC0968
    /* JADX INFO: renamed from: ᵲᵶᵳˈ */
    public final void mo3285() {
        for (C3511 c3511 : this.f19403) {
            c3511.f13484.mo1256();
        }
    }

    @Override // defpackage.InterfaceC0968
    /* JADX INFO: renamed from: ᵵᵽ */
    public final boolean mo3286(AbstractC1900 abstractC1900, boolean z, C1785 c1785, C1013 c1013) {
        long jElapsedRealtime = SystemClock.elapsedRealtime();
        int length = this.f19404.length();
        int i = 0;
        for (int i2 = 0; i2 < length; i2++) {
            if (this.f19404.mo3737(jElapsedRealtime, i2)) {
                i++;
            }
        }
        C4973 c4973 = new C4973(1, 0, length, i);
        c1013.getClass();
        C0655 c0655M3344 = C1013.m3344(c4973, c1785);
        if (z && c0655M3344 != null && c0655M3344.f3092 == 2) {
            InterfaceC2380 interfaceC2380 = this.f19404;
            if (interfaceC2380.mo3739(c0655M3344.f3093, interfaceC2380.mo3744(abstractC1900.f7531))) {
                return true;
            }
        }
        return false;
    }

    @Override // defpackage.InterfaceC0968
    /* JADX INFO: renamed from: ᵷᵺʾᵖ */
    public final void mo3287(C2348 c2348, long j, List list, C5559 c5559) {
        List list2;
        int iMo3274;
        long jM11125;
        InterfaceC2380 interfaceC2380;
        if (this.f19402 != null) {
            return;
        }
        C5494[] c5494Arr = this.f19408.f2552;
        int i = this.f19401;
        C5494 c5494 = c5494Arr[i];
        int i2 = c5494.f20769;
        long[] jArr = c5494.f20764;
        if (i2 == 0) {
            c5559.f20983 = !r4.f2551;
            return;
        }
        if (list.isEmpty()) {
            iMo3274 = AbstractC0956.m3271(jArr, j, true);
            list2 = list;
        } else {
            list2 = list;
            iMo3274 = (int) (((AbstractC4352) list2.get(list.size() - 1)).mo3274() - ((long) this.f19406));
            if (iMo3274 < 0) {
                this.f19402 = new BehindLiveWindowException();
                return;
            }
        }
        if (iMo3274 >= c5494.f20769) {
            c5559.f20983 = !this.f19408.f2551;
            return;
        }
        long j2 = c2348.f9212;
        long j3 = j - j2;
        C0464 c0464 = this.f19408;
        if (c0464.f2551) {
            C5494 c54942 = c0464.f2552[i];
            int i3 = c54942.f20769 - 1;
            jM11125 = (c54942.m11125(i3) + c54942.f20764[i3]) - j2;
        } else {
            jM11125 = -9223372036854775807L;
        }
        int length = this.f19404.length();
        InterfaceC2178[] interfaceC2178Arr = new InterfaceC2178[length];
        int i4 = 0;
        while (true) {
            interfaceC2380 = this.f19404;
            if (i4 >= length) {
                break;
            }
            interfaceC2380.mo3741(i4);
            interfaceC2178Arr[i4] = new C4904(c5494, iMo3274);
            i4++;
        }
        interfaceC2380.mo3510(j2, j3, jM11125, list2, interfaceC2178Arr);
        long j4 = jArr[iMo3274];
        long jM111252 = c5494.m11125(iMo3274) + j4;
        long j5 = list.isEmpty() ? j : -9223372036854775807L;
        int i5 = this.f19406 + iMo3274;
        int iMo3508 = this.f19404.mo3508();
        C3511 c3511 = this.f19403[iMo3508];
        int iMo3741 = this.f19404.mo3741(iMo3508);
        List list3 = c5494.f20759;
        C5286[] c5286Arr = c5494.f20766;
        ᵻᵪ.ˌᴵ(c5286Arr != null);
        ᵻᵪ.ˌᴵ(list3 != null);
        ᵻᵪ.ˌᴵ(iMo3274 < list3.size());
        String string = Integer.toString(c5286Arr[iMo3741].f19991);
        String string2 = ((Long) list3.get(iMo3274)).toString();
        Uri uri = ᵶᵦ.ᵯᵷʽ(c5494.f20765, c5494.f20761.replace("{bitrate}", string).replace("{Bitrate}", string).replace("{start time}", string2).replace("{start_time}", string2));
        SystemClock.elapsedRealtime();
        C5286 c5286Mo3738 = this.f19404.mo3738();
        int iMo3509 = this.f19404.mo3509();
        Object objMo3507 = this.f19404.mo3507();
        Map map = Collections.EMPTY_MAP;
        ᵻᵪ.ᵱʡˏ(uri, "The uri must be set.");
        c5559.f20984 = new C0957(this.f19407, new C0084(uri, 1, null, map, 0L, -1L, null, 0), c5286Mo3738, iMo3509, objMo3507, j4, jM111252, j5, -9223372036854775807L, i5, 1, j4, c3511);
    }

    @Override // defpackage.InterfaceC0968
    /* JADX INFO: renamed from: ᵻˈᵦʼ */
    public final boolean mo3288(long j, AbstractC1900 abstractC1900, List list) {
        if (this.f19402 != null) {
            return false;
        }
        return this.f19404.mo3746(j, abstractC1900, list);
    }
}
