package p138.p176.p177.p190.p226.p227;

import android.graphics.Color;
import android.text.Layout;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.style.BackgroundColorSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.StyleSpan;
import android.text.style.UnderlineSpan;
import android.util.Log;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import p000.p001.p002.p003.p004.C0567;
import p138.p139.p143.p144.C2803;
import p138.p176.p177.p190.p226.C3946;
import p138.p176.p177.p190.p226.C3953;
import p138.p176.p177.p190.p226.InterfaceC3949;
import p138.p176.p177.p190.p239.C4139;
import p138.p176.p177.p190.p239.C4140;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ໟ.މ.ހ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C3961 extends AbstractC3964 {

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final C4140 f12444 = new C4140();

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final C4139 f12445 = new C4139();

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

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public final C3962[] f12447;

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public C3962 f12448;

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public List<C3946> f12449;

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public List<C3946> f12450;

    /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
    public C3963 f12451;

    /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
    public int f12452;

    /* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ໟ.މ.ހ$֏, reason: contains not printable characters */
    public static final class C3962 {

        /* JADX INFO: renamed from: ޔ, reason: contains not printable characters */
        public static final int f12453 = m6400(2, 2, 2, 0);

        /* JADX INFO: renamed from: ޕ, reason: contains not printable characters */
        public static final int f12454 = m6400(0, 0, 0, 0);

        /* JADX INFO: renamed from: ޖ, reason: contains not printable characters */
        public static final int f12455;

        /* JADX INFO: renamed from: ޗ, reason: contains not printable characters */
        public static final int[] f12456;

        /* JADX INFO: renamed from: ޘ, reason: contains not printable characters */
        public static final int[] f12457;

        /* JADX INFO: renamed from: ޙ, reason: contains not printable characters */
        public static final int[] f12458;

        /* JADX INFO: renamed from: ޚ, reason: contains not printable characters */
        public static final boolean[] f12459;

        /* JADX INFO: renamed from: ޛ, reason: contains not printable characters */
        public static final int[] f12460;

        /* JADX INFO: renamed from: ޜ, reason: contains not printable characters */
        public static final int[] f12461;

        /* JADX INFO: renamed from: ޝ, reason: contains not printable characters */
        public static final int[] f12462;

        /* JADX INFO: renamed from: ޞ, reason: contains not printable characters */
        public static final int[] f12463;

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final List<SpannableString> f12464 = new ArrayList();

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public final SpannableStringBuilder f12465 = new SpannableStringBuilder();

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public boolean f12466;

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

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public int f12468;

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public boolean f12469;

        /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
        public int f12470;

        /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
        public int f12471;

        /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
        public int f12472;

        /* JADX INFO: renamed from: އ, reason: contains not printable characters */
        public int f12473;

        /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
        public boolean f12474;

        /* JADX INFO: renamed from: މ, reason: contains not printable characters */
        public int f12475;

        /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
        public int f12476;

        /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
        public int f12477;

        /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
        public int f12478;

        /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
        public int f12479;

        /* JADX INFO: renamed from: ގ, reason: contains not printable characters */
        public int f12480;

        /* JADX INFO: renamed from: ޏ, reason: contains not printable characters */
        public int f12481;

        /* JADX INFO: renamed from: ސ, reason: contains not printable characters */
        public int f12482;

        /* JADX INFO: renamed from: ޑ, reason: contains not printable characters */
        public int f12483;

        /* JADX INFO: renamed from: ޒ, reason: contains not printable characters */
        public int f12484;

        /* JADX INFO: renamed from: ޓ, reason: contains not printable characters */
        public int f12485;

        static {
            int iM6400 = m6400(0, 0, 0, 3);
            f12455 = iM6400;
            f12456 = new int[]{0, 0, 0, 0, 0, 2, 0};
            f12457 = new int[]{0, 0, 0, 0, 0, 0, 2};
            f12458 = new int[]{3, 3, 3, 3, 3, 3, 1};
            f12459 = new boolean[]{false, false, false, true, true, true, false};
            int i = f12454;
            f12460 = new int[]{i, iM6400, i, i, iM6400, i, i};
            f12461 = new int[]{0, 1, 2, 3, 4, 3, 4};
            f12462 = new int[]{0, 0, 0, 0, 0, 3, 3};
            f12463 = new int[]{i, i, i, i, i, iM6400, iM6400};
        }

        public C3962() {
            m6407();
        }

        /* JADX WARN: Removed duplicated region for block: B:12:0x0021  */
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public static int m6400(int i, int i2, int i3, int i4) {
            int i5;
            C0567.m1842(i, 0, 4);
            C0567.m1842(i2, 0, 4);
            C0567.m1842(i3, 0, 4);
            C0567.m1842(i4, 0, 4);
            if (i4 == 0 || i4 == 1) {
                i5 = 255;
            } else if (i4 == 2) {
                i5 = 127;
            } else if (i4 == 3) {
                i5 = 0;
            }
            return Color.argb(i5, i > 1 ? 255 : 0, i2 > 1 ? 255 : 0, i3 > 1 ? 255 : 0);
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public SpannableString m6401() {
            SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(this.f12465);
            int length = spannableStringBuilder.length();
            if (length > 0) {
                if (this.f12479 != -1) {
                    spannableStringBuilder.setSpan(new StyleSpan(2), this.f12479, length, 33);
                }
                if (this.f12480 != -1) {
                    spannableStringBuilder.setSpan(new UnderlineSpan(), this.f12480, length, 33);
                }
                if (this.f12481 != -1) {
                    spannableStringBuilder.setSpan(new ForegroundColorSpan(this.f12482), this.f12481, length, 33);
                }
                if (this.f12483 != -1) {
                    spannableStringBuilder.setSpan(new BackgroundColorSpan(this.f12484), this.f12483, length, 33);
                }
            }
            return new SpannableString(spannableStringBuilder);
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void m6402(char c) {
            if (c != '\n') {
                this.f12465.append(c);
                return;
            }
            this.f12464.add(m6401());
            this.f12465.clear();
            if (this.f12479 != -1) {
                this.f12479 = 0;
            }
            if (this.f12480 != -1) {
                this.f12480 = 0;
            }
            if (this.f12481 != -1) {
                this.f12481 = 0;
            }
            if (this.f12483 != -1) {
                this.f12483 = 0;
            }
            while (true) {
                if ((!this.f12474 || this.f12464.size() < this.f12473) && this.f12464.size() < 15) {
                    return;
                } else {
                    this.f12464.remove(0);
                }
            }
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void m6403(int i, int i2) {
            if (this.f12481 != -1 && this.f12482 != i) {
                this.f12465.setSpan(new ForegroundColorSpan(this.f12482), this.f12481, this.f12465.length(), 33);
            }
            if (i != f12453) {
                this.f12481 = this.f12465.length();
                this.f12482 = i;
            }
            if (this.f12483 != -1 && this.f12484 != i2) {
                this.f12465.setSpan(new BackgroundColorSpan(this.f12484), this.f12483, this.f12465.length(), 33);
            }
            if (i2 != f12454) {
                this.f12483 = this.f12465.length();
                this.f12484 = i2;
            }
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void m6404(boolean z, boolean z2) {
            if (this.f12479 != -1) {
                if (!z) {
                    this.f12465.setSpan(new StyleSpan(2), this.f12479, this.f12465.length(), 33);
                    this.f12479 = -1;
                }
            } else if (z) {
                this.f12479 = this.f12465.length();
            }
            if (this.f12480 == -1) {
                if (z2) {
                    this.f12480 = this.f12465.length();
                }
            } else {
                if (z2) {
                    return;
                }
                this.f12465.setSpan(new UnderlineSpan(), this.f12480, this.f12465.length(), 33);
                this.f12480 = -1;
            }
        }

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public void m6405() {
            this.f12464.clear();
            this.f12465.clear();
            this.f12479 = -1;
            this.f12480 = -1;
            this.f12481 = -1;
            this.f12483 = -1;
            this.f12485 = 0;
        }

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public boolean m6406() {
            return !this.f12466 || (this.f12464.isEmpty() && this.f12465.length() == 0);
        }

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public void m6407() {
            m6405();
            this.f12466 = false;
            this.f12467 = false;
            this.f12468 = 4;
            this.f12469 = false;
            this.f12470 = 0;
            this.f12471 = 0;
            this.f12472 = 0;
            this.f12473 = 15;
            this.f12474 = true;
            this.f12475 = 0;
            this.f12476 = 0;
            this.f12477 = 0;
            int i = f12454;
            this.f12478 = i;
            this.f12482 = f12453;
            this.f12484 = i;
        }
    }

    /* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ໟ.މ.ހ$ؠ, reason: contains not printable characters */
    public static final class C3963 {

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

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

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public final byte[] f12488;

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public int f12489 = 0;

        public C3963(int i, int i2) {
            this.f12486 = i;
            this.f12487 = i2;
            this.f12488 = new byte[(i2 * 2) - 1];
        }
    }

    public C3961(int i) {
        this.f12446 = i == -1 ? 1 : i;
        this.f12447 = new C3962[8];
        for (int i2 = 0; i2 < 8; i2++) {
            this.f12447[i2] = new C3962();
        }
        this.f12448 = this.f12447[0];
        m6399();
    }

    @Override // p138.p176.p177.p190.p226.p227.AbstractC3964, p138.p176.p177.p190.p193.InterfaceC3509
    public void flush() {
        super.flush();
        this.f12449 = null;
        this.f12450 = null;
        this.f12452 = 0;
        this.f12448 = this.f12447[0];
        m6399();
        this.f12451 = null;
    }

    @Override // p138.p176.p177.p190.p226.p227.AbstractC3964
    /* JADX INFO: renamed from: ֏ */
    public void mo6386(C3953 c3953) {
        this.f12444.m6684(c3953.f10461.array(), c3953.f10461.limit());
        while (this.f12444.m6679() >= 3) {
            int iM6702 = this.f12444.m6702() & 7;
            int i = iM6702 & 3;
            boolean z = (iM6702 & 4) == 4;
            byte bM6702 = (byte) this.f12444.m6702();
            byte bM67022 = (byte) this.f12444.m6702();
            if (i == 2 || i == 3) {
                if (z) {
                    if (i == 3) {
                        m6397();
                        int i2 = (bM6702 & 192) >> 6;
                        int i3 = bM6702 & 63;
                        if (i3 == 0) {
                            i3 = 64;
                        }
                        C3963 c3963 = new C3963(i2, i3);
                        this.f12451 = c3963;
                        byte[] bArr = c3963.f12488;
                        int i4 = c3963.f12489;
                        c3963.f12489 = i4 + 1;
                        bArr[i4] = bM67022;
                    } else {
                        C0567.m1896(i == 2);
                        C3963 c39632 = this.f12451;
                        if (c39632 == null) {
                            Log.e("Cea708Decoder", "Encountered DTVCC_PACKET_DATA before DTVCC_PACKET_START");
                        } else {
                            byte[] bArr2 = c39632.f12488;
                            int i5 = c39632.f12489;
                            int i6 = i5 + 1;
                            c39632.f12489 = i6;
                            bArr2[i5] = bM6702;
                            c39632.f12489 = i6 + 1;
                            bArr2[i6] = bM67022;
                        }
                    }
                    C3963 c39633 = this.f12451;
                    if (c39633.f12489 == (c39633.f12487 * 2) - 1) {
                        m6397();
                    }
                }
            }
        }
    }

    @Override // p138.p176.p177.p190.p193.InterfaceC3509
    /* JADX INFO: renamed from: ؠ */
    public String mo1135() {
        return "Cea708Decoder";
    }

    @Override // p138.p176.p177.p190.p226.p227.AbstractC3964
    /* JADX INFO: renamed from: ނ */
    public InterfaceC3949 mo6388() {
        List<C3946> list = this.f12449;
        this.f12450 = list;
        return new C3968(list);
    }

    @Override // p138.p176.p177.p190.p226.p227.AbstractC3964
    /* JADX INFO: renamed from: ރ */
    public boolean mo6389() {
        return this.f12449 != this.f12450;
    }

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final void m6397() {
        C3963 c3963 = this.f12451;
        if (c3963 == null) {
            return;
        }
        int i = c3963.f12489;
        if (i != (c3963.f12487 * 2) - 1) {
            StringBuilder sbM4889 = C2803.m4889("DtvCcPacket ended prematurely; size is ");
            sbM4889.append((this.f12451.f12487 * 2) - 1);
            sbM4889.append(", but current index is ");
            sbM4889.append(this.f12451.f12489);
            sbM4889.append(" (sequence number ");
            sbM4889.append(this.f12451.f12486);
            sbM4889.append("); ignoring packet");
            Log.w("Cea708Decoder", sbM4889.toString());
        } else {
            this.f12445.m6669(c3963.f12488, i);
            int i2 = 3;
            int iM6667 = this.f12445.m6667(3);
            int iM66672 = this.f12445.m6667(5);
            int i3 = 7;
            int i4 = 6;
            if (iM6667 == 7) {
                this.f12445.m6675(2);
                iM6667 = this.f12445.m6667(6);
                if (iM6667 < 7) {
                    C2803.m4900("Invalid extended service number: ", iM6667, "Cea708Decoder");
                }
            }
            if (iM66672 == 0) {
                if (iM6667 != 0) {
                    Log.w("Cea708Decoder", "serviceNumber is non-zero (" + iM6667 + ") when blockSize is 0");
                }
            } else if (iM6667 == this.f12446) {
                boolean z = false;
                while (this.f12445.m6671() > 0) {
                    int iM66673 = this.f12445.m6667(8);
                    if (iM66673 == 16) {
                        int iM66674 = this.f12445.m6667(8);
                        if (iM66674 > 31) {
                            if (iM66674 <= 127) {
                                if (iM66674 == 32) {
                                    this.f12448.m6402(' ');
                                } else if (iM66674 == 33) {
                                    this.f12448.m6402((char) 160);
                                } else if (iM66674 == 37) {
                                    this.f12448.m6402((char) 8230);
                                } else if (iM66674 == 42) {
                                    this.f12448.m6402((char) 352);
                                } else if (iM66674 == 44) {
                                    this.f12448.m6402((char) 338);
                                } else if (iM66674 == 63) {
                                    this.f12448.m6402((char) 376);
                                } else if (iM66674 == 57) {
                                    this.f12448.m6402((char) 8482);
                                } else if (iM66674 == 58) {
                                    this.f12448.m6402((char) 353);
                                } else if (iM66674 == 60) {
                                    this.f12448.m6402((char) 339);
                                } else if (iM66674 != 61) {
                                    switch (iM66674) {
                                        case 48:
                                            this.f12448.m6402((char) 9608);
                                            break;
                                        case 49:
                                            this.f12448.m6402((char) 8216);
                                            break;
                                        case 50:
                                            this.f12448.m6402((char) 8217);
                                            break;
                                        case 51:
                                            this.f12448.m6402((char) 8220);
                                            break;
                                        case 52:
                                            this.f12448.m6402((char) 8221);
                                            break;
                                        case 53:
                                            this.f12448.m6402((char) 8226);
                                            break;
                                        default:
                                            switch (iM66674) {
                                                case 118:
                                                    this.f12448.m6402((char) 8539);
                                                    break;
                                                case 119:
                                                    this.f12448.m6402((char) 8540);
                                                    break;
                                                case 120:
                                                    this.f12448.m6402((char) 8541);
                                                    break;
                                                case 121:
                                                    this.f12448.m6402((char) 8542);
                                                    break;
                                                case 122:
                                                    this.f12448.m6402((char) 9474);
                                                    break;
                                                case 123:
                                                    this.f12448.m6402((char) 9488);
                                                    break;
                                                case 124:
                                                    this.f12448.m6402((char) 9492);
                                                    break;
                                                case 125:
                                                    this.f12448.m6402((char) 9472);
                                                    break;
                                                case 126:
                                                    this.f12448.m6402((char) 9496);
                                                    break;
                                                case 127:
                                                    this.f12448.m6402((char) 9484);
                                                    break;
                                                default:
                                                    C2803.m4900("Invalid G2 character: ", iM66674, "Cea708Decoder");
                                                    break;
                                            }
                                            break;
                                    }
                                } else {
                                    this.f12448.m6402((char) 8480);
                                }
                            } else if (iM66674 <= 159) {
                                if (iM66674 <= 135) {
                                    this.f12445.m6675(32);
                                } else if (iM66674 <= 143) {
                                    this.f12445.m6675(40);
                                } else if (iM66674 <= 159) {
                                    this.f12445.m6675(2);
                                    this.f12445.m6675(this.f12445.m6667(6) * 8);
                                }
                            } else if (iM66674 > 255) {
                                C2803.m4900("Invalid extended command: ", iM66674, "Cea708Decoder");
                            } else if (iM66674 == 160) {
                                this.f12448.m6402((char) 13252);
                            } else {
                                C2803.m4900("Invalid G3 character: ", iM66674, "Cea708Decoder");
                                this.f12448.m6402('_');
                            }
                            z = true;
                        } else if (iM66674 > 7) {
                            if (iM66674 <= 15) {
                                this.f12445.m6675(8);
                            } else if (iM66674 <= 23) {
                                this.f12445.m6675(16);
                            } else if (iM66674 <= 31) {
                                this.f12445.m6675(24);
                            }
                        }
                    } else if (iM66673 > 31) {
                        if (iM66673 <= 127) {
                            if (iM66673 == 127) {
                                this.f12448.m6402((char) 9835);
                            } else {
                                this.f12448.m6402((char) (iM66673 & 255));
                            }
                        } else if (iM66673 <= 159) {
                            switch (iM66673) {
                                case 128:
                                case 129:
                                case 130:
                                case 131:
                                case 132:
                                case 133:
                                case 134:
                                case 135:
                                    int i5 = iM66673 - 128;
                                    if (this.f12452 != i5) {
                                        this.f12452 = i5;
                                        this.f12448 = this.f12447[i5];
                                    }
                                    break;
                                case 136:
                                    for (int i6 = 1; i6 <= 8; i6++) {
                                        if (this.f12445.m6677()) {
                                            this.f12447[8 - i6].m6405();
                                        }
                                    }
                                    break;
                                case 137:
                                    for (int i7 = 1; i7 <= 8; i7++) {
                                        if (this.f12445.m6677()) {
                                            this.f12447[8 - i7].f12467 = true;
                                        }
                                    }
                                    break;
                                case 138:
                                    for (int i8 = 1; i8 <= 8; i8++) {
                                        if (this.f12445.m6677()) {
                                            this.f12447[8 - i8].f12467 = false;
                                        }
                                    }
                                    break;
                                case 139:
                                    for (int i9 = 1; i9 <= 8; i9++) {
                                        if (this.f12445.m6677()) {
                                            this.f12447[8 - i9].f12467 = !r1.f12467;
                                        }
                                    }
                                    break;
                                case 140:
                                    for (int i10 = 1; i10 <= 8; i10++) {
                                        if (this.f12445.m6677()) {
                                            this.f12447[8 - i10].m6407();
                                        }
                                    }
                                    break;
                                case 141:
                                    this.f12445.m6675(8);
                                    break;
                                case 142:
                                    break;
                                case 143:
                                    m6399();
                                    break;
                                case 144:
                                    if (this.f12448.f12466) {
                                        this.f12445.m6667(4);
                                        this.f12445.m6667(2);
                                        this.f12445.m6667(2);
                                        boolean zM6677 = this.f12445.m6677();
                                        boolean zM66772 = this.f12445.m6677();
                                        this.f12445.m6667(3);
                                        this.f12445.m6667(3);
                                        this.f12448.m6404(zM6677, zM66772);
                                    } else {
                                        this.f12445.m6675(16);
                                    }
                                    break;
                                case 145:
                                    if (this.f12448.f12466) {
                                        int iM6400 = C3962.m6400(this.f12445.m6667(2), this.f12445.m6667(2), this.f12445.m6667(2), this.f12445.m6667(2));
                                        int iM64002 = C3962.m6400(this.f12445.m6667(2), this.f12445.m6667(2), this.f12445.m6667(2), this.f12445.m6667(2));
                                        this.f12445.m6675(2);
                                        C3962.m6400(this.f12445.m6667(2), this.f12445.m6667(2), this.f12445.m6667(2), 0);
                                        this.f12448.m6403(iM6400, iM64002);
                                    } else {
                                        this.f12445.m6675(24);
                                    }
                                    break;
                                case 146:
                                    if (this.f12448.f12466) {
                                        this.f12445.m6675(4);
                                        int iM66675 = this.f12445.m6667(4);
                                        this.f12445.m6675(2);
                                        this.f12445.m6667(6);
                                        C3962 c3962 = this.f12448;
                                        if (c3962.f12485 != iM66675) {
                                            c3962.m6402('\n');
                                        }
                                        c3962.f12485 = iM66675;
                                    } else {
                                        this.f12445.m6675(16);
                                    }
                                    break;
                                case 147:
                                case 148:
                                case 149:
                                case 150:
                                default:
                                    Log.w("Cea708Decoder", C2803.m4871("Invalid C1 command: ", iM66673));
                                    break;
                                case 151:
                                    if (this.f12448.f12466) {
                                        int iM64003 = C3962.m6400(this.f12445.m6667(2), this.f12445.m6667(2), this.f12445.m6667(2), this.f12445.m6667(2));
                                        this.f12445.m6667(2);
                                        C3962.m6400(this.f12445.m6667(2), this.f12445.m6667(2), this.f12445.m6667(2), 0);
                                        this.f12445.m6677();
                                        this.f12445.m6677();
                                        this.f12445.m6667(2);
                                        this.f12445.m6667(2);
                                        int iM66676 = this.f12445.m6667(2);
                                        this.f12445.m6675(8);
                                        C3962 c39622 = this.f12448;
                                        c39622.f12478 = iM64003;
                                        c39622.f12475 = iM66676;
                                    } else {
                                        this.f12445.m6675(32);
                                    }
                                    break;
                                case 152:
                                case 153:
                                case 154:
                                case 155:
                                case 156:
                                case 157:
                                case 158:
                                case 159:
                                    int i11 = iM66673 - 152;
                                    C3962 c39623 = this.f12447[i11];
                                    this.f12445.m6675(2);
                                    boolean zM66773 = this.f12445.m6677();
                                    boolean zM66774 = this.f12445.m6677();
                                    this.f12445.m6677();
                                    int iM66677 = this.f12445.m6667(i2);
                                    boolean zM66775 = this.f12445.m6677();
                                    int iM66678 = this.f12445.m6667(i3);
                                    int iM66679 = this.f12445.m6667(8);
                                    int iM666710 = this.f12445.m6667(4);
                                    int iM666711 = this.f12445.m6667(4);
                                    this.f12445.m6675(2);
                                    this.f12445.m6667(i4);
                                    this.f12445.m6675(2);
                                    int iM666712 = this.f12445.m6667(i2);
                                    int iM666713 = this.f12445.m6667(i2);
                                    c39623.f12466 = true;
                                    c39623.f12467 = zM66773;
                                    c39623.f12474 = zM66774;
                                    c39623.f12468 = iM66677;
                                    c39623.f12469 = zM66775;
                                    c39623.f12470 = iM66678;
                                    c39623.f12471 = iM66679;
                                    c39623.f12472 = iM666710;
                                    int i12 = iM666711 + 1;
                                    if (c39623.f12473 != i12) {
                                        c39623.f12473 = i12;
                                        while (true) {
                                            if ((zM66774 && c39623.f12464.size() >= c39623.f12473) || c39623.f12464.size() >= 15) {
                                                c39623.f12464.remove(0);
                                            }
                                        }
                                    }
                                    if (iM666712 != 0 && c39623.f12476 != iM666712) {
                                        c39623.f12476 = iM666712;
                                        int i13 = iM666712 - 1;
                                        int i14 = C3962.f12460[i13];
                                        boolean z2 = C3962.f12459[i13];
                                        int i15 = C3962.f12457[i13];
                                        int i16 = C3962.f12458[i13];
                                        int i17 = C3962.f12456[i13];
                                        c39623.f12478 = i14;
                                        c39623.f12475 = i17;
                                    }
                                    if (iM666713 != 0 && c39623.f12477 != iM666713) {
                                        c39623.f12477 = iM666713;
                                        int i18 = iM666713 - 1;
                                        int i19 = C3962.f12462[i18];
                                        int i20 = C3962.f12461[i18];
                                        c39623.m6404(false, false);
                                        c39623.m6403(C3962.f12453, C3962.f12463[i18]);
                                    }
                                    if (this.f12452 != i11) {
                                        this.f12452 = i11;
                                        this.f12448 = this.f12447[i11];
                                    }
                                    break;
                            }
                        } else if (iM66673 <= 255) {
                            this.f12448.m6402((char) (iM66673 & 255));
                        } else {
                            C2803.m4900("Invalid base command: ", iM66673, "Cea708Decoder");
                        }
                        z = true;
                    } else if (iM66673 != 0) {
                        if (iM66673 == i2) {
                            this.f12449 = m6398();
                        } else if (iM66673 != 8) {
                            switch (iM66673) {
                                case 12:
                                    m6399();
                                    break;
                                case 13:
                                    this.f12448.m6402('\n');
                                    break;
                                case 14:
                                    break;
                                default:
                                    if (iM66673 >= 17 && iM66673 <= 23) {
                                        C2803.m4900("Currently unsupported COMMAND_EXT1 Command: ", iM66673, "Cea708Decoder");
                                        this.f12445.m6675(8);
                                    } else if (iM66673 < 24 || iM66673 > 31) {
                                        C2803.m4900("Invalid C0 command: ", iM66673, "Cea708Decoder");
                                    } else {
                                        C2803.m4900("Currently unsupported COMMAND_P16 Command: ", iM66673, "Cea708Decoder");
                                        this.f12445.m6675(16);
                                    }
                                    break;
                            }
                        } else {
                            C3962 c39624 = this.f12448;
                            int length = c39624.f12465.length();
                            if (length > 0) {
                                c39624.f12465.delete(length - 1, length);
                            }
                        }
                    }
                    i2 = 3;
                    i3 = 7;
                    i4 = 6;
                }
                if (z) {
                    this.f12449 = m6398();
                }
            }
        }
        this.f12451 = null;
    }

    /* JADX WARN: Removed duplicated region for block: B:29:0x0081  */
    /* JADX WARN: Removed duplicated region for block: B:30:0x008c  */
    /* JADX WARN: Removed duplicated region for block: B:33:0x00ac  */
    /* JADX WARN: Removed duplicated region for block: B:34:0x00af  */
    /* JADX WARN: Removed duplicated region for block: B:39:0x00bb  */
    /* JADX WARN: Removed duplicated region for block: B:40:0x00be  */
    /* JADX WARN: Removed duplicated region for block: B:45:0x00cb  */
    /* JADX WARN: Removed duplicated region for block: B:46:0x00ce  */
    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final List<C3946> m6398() {
        Layout.Alignment alignment;
        float f;
        float f2;
        C3960 c3960;
        ArrayList arrayList = new ArrayList();
        for (int i = 0; i < 8; i++) {
            if (!this.f12447[i].m6406()) {
                C3962[] c3962Arr = this.f12447;
                if (c3962Arr[i].f12467) {
                    C3962 c3962 = c3962Arr[i];
                    if (c3962.m6406()) {
                        c3960 = null;
                    } else {
                        SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
                        for (int i2 = 0; i2 < c3962.f12464.size(); i2++) {
                            spannableStringBuilder.append((CharSequence) c3962.f12464.get(i2));
                            spannableStringBuilder.append('\n');
                        }
                        spannableStringBuilder.append((CharSequence) c3962.m6401());
                        int i3 = c3962.f12475;
                        if (i3 == 0) {
                            alignment = Layout.Alignment.ALIGN_NORMAL;
                            Layout.Alignment alignment2 = alignment;
                            if (c3962.f12469) {
                                f = c3962.f12471 / 209.0f;
                                f2 = c3962.f12470 / 74.0f;
                            } else {
                                f = c3962.f12471 / 99.0f;
                                f2 = c3962.f12470 / 99.0f;
                            }
                            float f3 = (f * 0.9f) + 0.05f;
                            float f4 = (f2 * 0.9f) + 0.05f;
                            int i4 = c3962.f12472 % 3;
                            int i5 = i4 != 0 ? 0 : i4 == 1 ? 1 : 2;
                            int i6 = c3962.f12472 / 3;
                            c3960 = new C3960(spannableStringBuilder, alignment2, f4, 0, i5, f3, i6 != 0 ? 0 : i6 == 1 ? 1 : 2, -3.4028235E38f, c3962.f12478 == C3962.f12454, c3962.f12478, c3962.f12468);
                        } else {
                            if (i3 == 1) {
                                alignment = Layout.Alignment.ALIGN_OPPOSITE;
                            } else if (i3 != 2) {
                                if (i3 != 3) {
                                    StringBuilder sbM4889 = C2803.m4889("Unexpected justification value: ");
                                    sbM4889.append(c3962.f12475);
                                    throw new IllegalArgumentException(sbM4889.toString());
                                }
                                alignment = Layout.Alignment.ALIGN_NORMAL;
                            } else {
                                alignment = Layout.Alignment.ALIGN_CENTER;
                            }
                            Layout.Alignment alignment22 = alignment;
                            if (c3962.f12469) {
                            }
                            float f32 = (f * 0.9f) + 0.05f;
                            float f42 = (f2 * 0.9f) + 0.05f;
                            int i42 = c3962.f12472 % 3;
                            if (i42 != 0) {
                            }
                            int i62 = c3962.f12472 / 3;
                            c3960 = new C3960(spannableStringBuilder, alignment22, f42, 0, i5, f32, i62 != 0 ? 0 : i62 == 1 ? 1 : 2, -3.4028235E38f, c3962.f12478 == C3962.f12454, c3962.f12478, c3962.f12468);
                        }
                    }
                    arrayList.add(c3960);
                } else {
                    continue;
                }
            }
        }
        Collections.sort(arrayList);
        return Collections.unmodifiableList(arrayList);
    }

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final void m6399() {
        for (int i = 0; i < 8; i++) {
            this.f12447[i].m6407();
        }
    }
}
