package defpackage;

import androidx.media3.container.NalUnitUtil;
import androidx.media3.exoplayer.upstream.CmcdData;
import com.google.android.gms.measurement.api.AppMeasurementSdk;
import java.util.List;
import java.util.Set;
import kotlin.Metadata;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\b&\u0018\u00002\u00020\u0001:\u0001\u0002¨\u0006\u0003"}, d2 = {"Le14;", "", CmcdData.OBJECT_TYPE_AUDIO_ONLY, "ktor-http"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
@vx8
public abstract class e14 {
    public final String a;
    public final List b;

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

    public e14(String str, List list) {
        cr4.g(str, "content");
        cr4.g(list, "parameters");
        this.a = str;
        this.b = list;
    }

    public final String a(String str) {
        cr4.g(str, AppMeasurementSdk.ConditionalUserProperty.NAME);
        List list = this.b;
        int iAe = y41.ae(list);
        if (iAe < 0) {
            return null;
        }
        int i = 0;
        while (true) {
            d14 d14Var = (d14) list.get(i);
            if (n89.u(d14Var.a, str)) {
                return d14Var.b;
            }
            if (i == iAe) {
                return null;
            }
            i++;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:39:0x00b0  */
    /* JADX WARN: Removed duplicated region for block: B:43:0x00d3  */
    /* JADX WARN: Removed duplicated region for block: B:62:0x0123 A[LOOP:1: B:12:0x0045->B:62:0x0123, LOOP_END] */
    /* JADX WARN: Removed duplicated region for block: B:66:0x0127 A[EDGE_INSN: B:66:0x0127->B:63:0x0127 BREAK  A[LOOP:1: B:12:0x0045->B:62:0x0123], SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final String toString() {
        int length;
        int i;
        int length2;
        int i2;
        List<d14> list = this.b;
        boolean zIsEmpty = list.isEmpty();
        String str = this.a;
        if (zIsEmpty) {
            return str;
        }
        int length3 = str.length();
        int length4 = 0;
        for (d14 d14Var : list) {
            length4 += d14Var.b.length() + d14Var.a.length() + 3;
        }
        StringBuilder sb = new StringBuilder(length3 + length4);
        sb.append(str);
        int iAe = y41.ae(list);
        if (iAe >= 0) {
            int i3 = 0;
            while (true) {
                d14 d14Var2 = (d14) list.get(i3);
                sb.append("; ");
                sb.append(d14Var2.a);
                sb.append("=");
                String str2 = d14Var2.b;
                Set set = f14.a;
                if (str2.length() == 0) {
                    cr4.g(str2, "<this>");
                    StringBuilder sb2 = new StringBuilder("\"");
                    length = str2.length();
                    while (i < length) {
                    }
                    sb2.append("\"");
                    String string = sb2.toString();
                    cr4.f(string, "toString(...)");
                    sb.append(string);
                    if (i3 != iAe) {
                    }
                } else if (str2.length() >= 2 && n89.v(str2) == '\"' && n89.ac(str2) == '\"') {
                    int i4 = 1;
                    do {
                        int iY = n89.y(str2, '\"', i4, 4);
                        if (iY == n89.x(str2)) {
                            break;
                        }
                        int i5 = 0;
                        for (int i6 = iY - 1; str2.charAt(i6) == '\\'; i6--) {
                            i5++;
                        }
                        if (i5 % 2 == 0) {
                            length2 = str2.length();
                            for (i2 = 0; i2 < length2; i2++) {
                                if (f14.a.contains(Character.valueOf(str2.charAt(i2)))) {
                                    cr4.g(str2, "<this>");
                                    StringBuilder sb22 = new StringBuilder("\"");
                                    length = str2.length();
                                    for (i = 0; i < length; i++) {
                                        char cCharAt = str2.charAt(i);
                                        if (cCharAt == '\t') {
                                            sb22.append("\\t");
                                        } else if (cCharAt == '\n') {
                                            sb22.append("\\n");
                                        } else if (cCharAt == '\r') {
                                            sb22.append("\\r");
                                        } else if (cCharAt == '\"') {
                                            sb22.append("\\\"");
                                        } else if (cCharAt != '\\') {
                                            sb22.append(cCharAt);
                                        } else {
                                            sb22.append("\\\\");
                                        }
                                    }
                                    sb22.append("\"");
                                    String string2 = sb22.toString();
                                    cr4.f(string2, "toString(...)");
                                    sb.append(string2);
                                    if (i3 != iAe) {
                                        break;
                                    }
                                    i3++;
                                }
                            }
                        } else {
                            i4 = iY + 1;
                        }
                    } while (i4 < str2.length());
                    sb.append(str2);
                    if (i3 != iAe) {
                    }
                } else {
                    length2 = str2.length();
                    while (i2 < length2) {
                    }
                    sb.append(str2);
                    if (i3 != iAe) {
                    }
                }
            }
        }
        String string3 = sb.toString();
        cr4.d(string3);
        return string3;
    }
}
