package defpackage;

import java.nio.ByteBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.StandardCharsets;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/* JADX INFO: renamed from: ˆˆˑ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C0818 extends ᵸᵺᵜ {

    /* JADX INFO: renamed from: ˊᵙᵾᵲ, reason: contains not printable characters */
    public static final Pattern f3677 = Pattern.compile("(.+?)='(.*?)';", 32);

    /* JADX INFO: renamed from: ᵟᵹᵙ, reason: contains not printable characters */
    public final CharsetDecoder f3678 = StandardCharsets.UTF_8.newDecoder();

    /* JADX INFO: renamed from: ᵱʡˏ, reason: contains not printable characters */
    public final CharsetDecoder f3679 = StandardCharsets.ISO_8859_1.newDecoder();

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public final C1956 m2934(C0899 c0899, ByteBuffer byteBuffer) {
        String string;
        CharsetDecoder charsetDecoder = this.f3679;
        CharsetDecoder charsetDecoder2 = this.f3678;
        String str = null;
        try {
            string = charsetDecoder2.decode(byteBuffer).toString();
        } catch (CharacterCodingException unused) {
            try {
                String string2 = charsetDecoder.decode(byteBuffer).toString();
                charsetDecoder.reset();
                byteBuffer.rewind();
                string = string2;
            } catch (CharacterCodingException unused2) {
                charsetDecoder.reset();
                byteBuffer.rewind();
                string = null;
            } catch (Throwable th) {
                charsetDecoder.reset();
                byteBuffer.rewind();
                throw th;
            }
        } finally {
            charsetDecoder2.reset();
            byteBuffer.rewind();
        }
        byte[] bArr = new byte[byteBuffer.limit()];
        byteBuffer.get(bArr);
        if (string == null) {
            return new C1956(new C3078(null, null, bArr));
        }
        Matcher matcher = f3677.matcher(string);
        String str2 = null;
        for (int iEnd = 0; matcher.find(iEnd); iEnd = matcher.end()) {
            String strGroup = matcher.group(1);
            String strGroup2 = matcher.group(2);
            if (strGroup != null) {
                String str3 = ᵻᵕᵭ.ʽᵡᵢᵾ(strGroup);
                str3.getClass();
                if (str3.equals("streamurl")) {
                    str2 = strGroup2;
                } else if (str3.equals("streamtitle")) {
                    str = strGroup2;
                }
            }
        }
        return new C1956(new C3078(str, str2, bArr));
    }
}
