package cr;

import kotlin.jvm.internal.t;
import kotlin.text.y;
import vq.p;

/* loaded from: classes3.dex */
public final class e {

    /* renamed from: a, reason: collision with root package name */
    public static final e f15555a = new e();

    /* renamed from: b, reason: collision with root package name */
    public static final kr.g f15556b = kr.g.f26649s.c("PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n");

    /* renamed from: c, reason: collision with root package name */
    private static final String[] f15557c = {"DATA", "HEADERS", "PRIORITY", "RST_STREAM", "SETTINGS", "PUSH_PROMISE", "PING", "GOAWAY", "WINDOW_UPDATE", "CONTINUATION"};

    /* renamed from: d, reason: collision with root package name */
    private static final String[] f15558d = new String[64];

    /* renamed from: e, reason: collision with root package name */
    private static final String[] f15559e;

    static {
        String I;
        String[] strArr = new String[256];
        for (int i10 = 0; i10 < 256; i10++) {
            String binaryString = Integer.toBinaryString(i10);
            t.f(binaryString, "toBinaryString(it)");
            I = y.I(p.i("%8s", binaryString), ' ', '0', false, 4, null);
            strArr[i10] = I;
        }
        f15559e = strArr;
        String[] strArr2 = f15558d;
        strArr2[0] = "";
        strArr2[1] = "END_STREAM";
        int[] iArr = {1};
        strArr2[8] = "PADDED";
        int i11 = iArr[0];
        strArr2[i11 | 8] = strArr2[i11] + "|PADDED";
        strArr2[4] = "END_HEADERS";
        strArr2[32] = "PRIORITY";
        strArr2[36] = "END_HEADERS|PRIORITY";
        int[] iArr2 = {4, 32, 36};
        for (int i12 = 0; i12 < 3; i12++) {
            int i13 = iArr2[i12];
            int i14 = iArr[0];
            String[] strArr3 = f15558d;
            int i15 = i14 | i13;
            strArr3[i15] = strArr3[i14] + '|' + strArr3[i13];
            strArr3[i15 | 8] = strArr3[i14] + '|' + strArr3[i13] + "|PADDED";
        }
        int length = f15558d.length;
        for (int i16 = 0; i16 < length; i16++) {
            String[] strArr4 = f15558d;
            if (strArr4[i16] == null) {
                strArr4[i16] = f15559e[i16];
            }
        }
    }

    private e() {
    }

    public final String a(int i10, int i11) {
        String str;
        String J;
        String J2;
        if (i11 == 0) {
            return "";
        }
        if (i10 != 2 && i10 != 3) {
            if (i10 == 4 || i10 == 6) {
                return i11 == 1 ? "ACK" : f15559e[i11];
            }
            if (i10 != 7 && i10 != 8) {
                String[] strArr = f15558d;
                if (i11 < strArr.length) {
                    str = strArr[i11];
                    t.d(str);
                } else {
                    str = f15559e[i11];
                }
                String str2 = str;
                if (i10 == 5 && (i11 & 4) != 0) {
                    J2 = y.J(str2, "HEADERS", "PUSH_PROMISE", false, 4, null);
                    return J2;
                }
                if (i10 != 0 || (i11 & 32) == 0) {
                    return str2;
                }
                J = y.J(str2, "PRIORITY", "COMPRESSED", false, 4, null);
                return J;
            }
        }
        return f15559e[i11];
    }

    public final String b(int i10) {
        String[] strArr = f15557c;
        return i10 < strArr.length ? strArr[i10] : p.i("0x%02x", Integer.valueOf(i10));
    }

    public final String c(boolean z10, int i10, int i11, int i12, int i13) {
        return p.i("%s 0x%08x %5d %-13s %s", z10 ? "<<" : ">>", Integer.valueOf(i10), Integer.valueOf(i11), b(i12), a(i12, i13));
    }

    public final String d(boolean z10, int i10, int i11, long j10) {
        return p.i("%s 0x%08x %5d %-13s %d", z10 ? "<<" : ">>", Integer.valueOf(i10), Integer.valueOf(i11), b(8), Long.valueOf(j10));
    }
}
