package defpackage;

import androidx.media3.common.MimeTypes;
import androidx.media3.container.NalUnitUtil;
import androidx.media3.exoplayer.upstream.CmcdData;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import kotlin.Metadata;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\n\u0018\u00002\u00020\u0001:\t\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n¨\u0006\u000b"}, d2 = {"Lhf1;", "Le14;", "c", CmcdData.OBJECT_TYPE_AUDIO_ONLY, "b", "e", "f", "g", CmcdData.STREAMING_FORMAT_HLS, CmcdData.OBJECT_TYPE_INIT_SEGMENT, "d", "ktor-http"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
@vx8
public final class hf1 extends e14 {
    public static final hf1 e = new hf1("*", "*", ik2.a);
    public final String c;
    public final String d;

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lhf1$a;", "", "ktor-http"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class a {
        public static final hf1 a;
        public static final hf1 b;

        static {
            ik2 ik2Var = ik2.a;
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "*", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "atom+xml", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "cbor", ik2Var);
            a = new hf1(MimeTypes.BASE_TYPE_APPLICATION, "json", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "hal+json", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "javascript", ik2Var);
            b = new hf1(MimeTypes.BASE_TYPE_APPLICATION, "octet-stream", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "rss+xml", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "soap+xml", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "xml", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "xml-dtd", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "zip", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "gzip", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "x-www-form-urlencoded", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "pdf", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "vnd.openxmlformats-officedocument.spreadsheetml.sheet", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "vnd.openxmlformats-officedocument.wordprocessingml.document", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "vnd.openxmlformats-officedocument.presentationml.presentation", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "protobuf", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "wasm", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "problem+json", ik2Var);
            new hf1(MimeTypes.BASE_TYPE_APPLICATION, "problem+xml", ik2Var);
        }
    }

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lhf1$b;", "", "ktor-http"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class b {
        static {
            ik2 ik2Var = ik2.a;
            new hf1("audio", "*", ik2Var);
            new hf1("audio", "mp4", ik2Var);
            new hf1("audio", "mpeg", ik2Var);
            new hf1("audio", "ogg", ik2Var);
        }
    }

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\b\u0086\u0003\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lhf1$c;", "", "ktor-http"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    @vx8
    public static final class c {
        public static hf1 a(String str) throws g60 {
            if (n89.ab(str)) {
                return hf1.e;
            }
            b14 b14Var = (b14) y41.ak(oc4.a(str));
            String str2 = b14Var.a;
            List list = b14Var.b;
            int iY = n89.y(str2, '/', 0, 6);
            if (iY == -1) {
                if (cr4.b(n89.bg(str2).toString(), "*")) {
                    return hf1.e;
                }
                throw new g60("Bad Content-Type format: ".concat(str));
            }
            String strSubstring = str2.substring(0, iY);
            cr4.f(strSubstring, "substring(...)");
            String string = n89.bg(strSubstring).toString();
            if (string.length() == 0) {
                throw new g60("Bad Content-Type format: ".concat(str));
            }
            String strSubstring2 = str2.substring(iY + 1);
            cr4.f(strSubstring2, "substring(...)");
            String string2 = n89.bg(strSubstring2).toString();
            if (n89.m(string, ' ') || n89.m(string2, ' ')) {
                throw new g60("Bad Content-Type format: ".concat(str));
            }
            if (string2.length() == 0 || n89.m(string2, '/')) {
                throw new g60("Bad Content-Type format: ".concat(str));
            }
            return new hf1(string, string2, list);
        }
    }

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lhf1$d;", "", "ktor-http"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class d {
        static {
            ik2 ik2Var = ik2.a;
            new hf1("font", "*", ik2Var);
            new hf1("font", "collection", ik2Var);
            new hf1("font", "otf", ik2Var);
            new hf1("font", "sfnt", ik2Var);
            new hf1("font", "ttf", ik2Var);
            new hf1("font", "woff", ik2Var);
            new hf1("font", "woff2", ik2Var);
        }
    }

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lhf1$e;", "", "ktor-http"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class e {
        static {
            ik2 ik2Var = ik2.a;
            new hf1("image", "*", ik2Var);
            new hf1("image", "gif", ik2Var);
            new hf1("image", "jpeg", ik2Var);
            new hf1("image", "png", ik2Var);
            new hf1("image", "svg+xml", ik2Var);
            new hf1("image", "x-icon", ik2Var);
        }
    }

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lhf1$f;", "", "ktor-http"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class f {
        static {
            ik2 ik2Var = ik2.a;
            new hf1("message", "*", ik2Var);
            new hf1("message", "http", ik2Var);
        }
    }

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lhf1$g;", "", "ktor-http"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class g {
        static {
            ik2 ik2Var = ik2.a;
            new hf1("multipart", "*", ik2Var);
            new hf1("multipart", "mixed", ik2Var);
            new hf1("multipart", "alternative", ik2Var);
            new hf1("multipart", "related", ik2Var);
            new hf1("multipart", "form-data", ik2Var);
            new hf1("multipart", "signed", ik2Var);
            new hf1("multipart", "encrypted", ik2Var);
            new hf1("multipart", "byteranges", ik2Var);
        }
    }

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lhf1$h;", "", "ktor-http"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class h {
        public static final hf1 a;
        public static final hf1 b;

        static {
            ik2 ik2Var = ik2.a;
            new hf1("text", "*", ik2Var);
            a = new hf1("text", "plain", ik2Var);
            new hf1("text", "css", ik2Var);
            new hf1("text", "csv", ik2Var);
            new hf1("text", "html", ik2Var);
            new hf1("text", "javascript", ik2Var);
            new hf1("text", "vcard", ik2Var);
            new hf1("text", "xml", ik2Var);
            b = new hf1("text", "event-stream", ik2Var);
        }
    }

    @Metadata(d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001¨\u0006\u0002"}, d2 = {"Lhf1$i;", "", "ktor-http"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class i {
        static {
            ik2 ik2Var = ik2.a;
            new hf1("video", "*", ik2Var);
            new hf1("video", "mpeg", ik2Var);
            new hf1("video", "mp4", ik2Var);
            new hf1("video", "ogg", ik2Var);
            new hf1("video", "quicktime", ik2Var);
        }
    }

    public hf1(String str, String str2, String str3, List list) {
        super(str3, list);
        this.c = str;
        this.d = str2;
    }

    /* JADX WARN: Removed duplicated region for block: B:24:0x0060  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean b(hf1 hf1Var) {
        boolean zU;
        cr4.g(hf1Var, "pattern");
        String str = hf1Var.d;
        String str2 = hf1Var.c;
        if ((cr4.b(str2, "*") || n89.u(str2, this.c)) && (cr4.b(str, "*") || n89.u(str, this.d))) {
            Iterator it = hf1Var.b.iterator();
            do {
                zU = true;
                if (!it.hasNext()) {
                    return true;
                }
                d14 d14Var = (d14) it.next();
                String str3 = d14Var.a;
                String str4 = d14Var.b;
                if (!cr4.b(str3, "*")) {
                    String strA = a(str3);
                    if (!cr4.b(str4, "*")) {
                        zU = n89.u(strA, str4);
                    } else if (strA != null) {
                    }
                } else if (!cr4.b(str4, "*")) {
                    List list = this.b;
                    if ((list instanceof Collection) && list.isEmpty()) {
                        zU = false;
                    } else {
                        Iterator it2 = list.iterator();
                        while (it2.hasNext()) {
                            if (n89.u(((d14) it2.next()).b, str4)) {
                                break;
                            }
                        }
                        zU = false;
                    }
                }
            } while (zU);
        }
        return false;
    }

    /* JADX WARN: Code restructure failed: missing block: B:22:0x0054, code lost:
    
        if (defpackage.n89.u(r1.b, r6) != false) goto L23;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final hf1 c(String str) {
        List list = this.b;
        int size = list.size();
        if (size != 0) {
            if (size != 1) {
                List<d14> list2 = list;
                if (!(list2 instanceof Collection) || !list2.isEmpty()) {
                    for (d14 d14Var : list2) {
                        if (n89.u(d14Var.a, "charset") && n89.u(d14Var.b, str)) {
                            return this;
                        }
                    }
                }
            } else {
                d14 d14Var2 = (d14) list.get(0);
                if (n89.u(d14Var2.a, "charset")) {
                }
            }
        }
        return new hf1(this.c, this.d, this.a, y41.av(list, new d14("charset", str)));
    }

    public final hf1 d() {
        if (this.b.isEmpty()) {
            return this;
        }
        return new hf1(this.c, this.d, ik2.a);
    }

    public final boolean equals(Object obj) {
        if (!(obj instanceof hf1)) {
            return false;
        }
        hf1 hf1Var = (hf1) obj;
        return n89.u(this.c, hf1Var.c) && n89.u(this.d, hf1Var.d) && cr4.b(this.b, hf1Var.b);
    }

    public final int hashCode() {
        Locale locale = Locale.ROOT;
        String lowerCase = this.c.toLowerCase(locale);
        cr4.f(lowerCase, "toLowerCase(...)");
        int iHashCode = lowerCase.hashCode();
        String lowerCase2 = this.d.toLowerCase(locale);
        cr4.f(lowerCase2, "toLowerCase(...)");
        return (this.b.hashCode() * 31) + lowerCase2.hashCode() + (iHashCode * 31) + iHashCode;
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public hf1(String str, String str2, List list) {
        this(str, str2, str + '/' + str2, list);
        cr4.g(str, "contentType");
        cr4.g(str2, "contentSubtype");
        cr4.g(list, "parameters");
    }
}
