Driving Zone: Germany v1.22.4版本的 MD5 值为:2b6e2d8e8733a3104dcc306c5770286c

以下内容为反编译后的 a.java 源代码,内容仅作参考


package com.appodeal.ads.modules.libs.network.httpclients;

import com.appodeal.ads.modules.common.internal.log.InternalLogKt;
import com.appodeal.ads.modules.libs.network.HttpClient;
import com.appodeal.ads.modules.libs.network.HttpError;
import com.appodeal.ads.modules.libs.network.Networking;
import com.appodeal.ads.modules.libs.network.httpclients.e;
import com.google.common.net.HttpHeaders;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.collections.CollectionsKt;
import kotlin.collections.MapsKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
import kotlin.text.StringsKt;

public final class a implements Networking {

    public final Map<String, List<String>> f2254a;
    public final List<com.appodeal.ads.modules.libs.network.encoders.d> b;
    public final List<com.appodeal.ads.modules.libs.network.encoders.c> c;
    public final d d;

    public a(Map<String, ? extends List<String>> headers, List<? extends com.appodeal.ads.modules.libs.network.encoders.d> encoders, List<? extends com.appodeal.ads.modules.libs.network.encoders.c> decoders) {
        Intrinsics.checkNotNullParameter(headers, "headers");
        Intrinsics.checkNotNullParameter(encoders, "encoders");
        Intrinsics.checkNotNullParameter(decoders, "decoders");
        this.f2254a = headers;
        this.b = encoders;
        this.c = decoders;
        this.d = new d();
    }

    @Override
    public final <Response> Object mo88enqueueyxL6bBk(HttpClient.Method method, String url, byte[] bArr, Function1<? super byte[], ? extends Response> parser, boolean z) {
        Intrinsics.checkNotNullParameter(method, "method");
        Intrinsics.checkNotNullParameter(url, "url");
        Intrinsics.checkNotNullParameter(parser, "parser");
        StringBuilder sb = new StringBuilder();
        sb.append("--> ");
        sb.append(method);
        sb.append(' ');
        sb.append(url);
        sb.append(", request body: ");
        sb.append(new String(bArr == null ? new byte[0] : bArr, Charsets.UTF_8));
        Response response = null;
        InternalLogKt.logInternal$default("HttpClientImpl", sb.toString(), null, 4, null);
        List<com.appodeal.ads.modules.libs.network.encoders.d> list = this.b;
        Map emptyMap = MapsKt.emptyMap();
        Iterator it = list.iterator();
        while (it.hasNext()) {
            emptyMap = MapsKt.plus(emptyMap, ((com.appodeal.ads.modules.libs.network.encoders.d) it.next()).a());
        }
        Map<String, List<String>> map = this.f2254a;
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        linkedHashMap.putAll(emptyMap);
        for (Map.Entry<String, List<String>> entry : map.entrySet()) {
            String key = entry.getKey();
            List<String> value = entry.getValue();
            if (linkedHashMap.containsKey(key)) {
                List list2 = (List) linkedHashMap.get(key);
                if (list2 == null) {
                    list2 = CollectionsKt.emptyList();
                }
                value = CollectionsKt.distinct(CollectionsKt.plus((Collection) list2, (Iterable) value));
            }
            linkedHashMap.put(key, value);
        }
        Map mutableMap = MapsKt.toMutableMap(linkedHashMap);
        com.appodeal.ads.modules.libs.network.httpclients.verification.b a2 = com.appodeal.ads.modules.libs.network.httpclients.verification.a.a();
        if (z && !StringsKt.startsWith$default(url, "https://a.appbaqend.com", false, 2, (Object) null)) {
            mutableMap.put(HttpHeaders.X_REQUEST_ID, CollectionsKt.listOf(a2.a()));
        }
        byte[] a3 = bArr == null ? null : com.appodeal.ads.modules.libs.network.encoders.ext.a.a(bArr, this.b);
        if (a3 == null) {
            a3 = new byte[0];
        }
        c cVar = new c(method, url, a3, mutableMap);
        this.d.getClass();
        Object a4 = d.a(cVar);
        if (Result.m807isSuccessimpl(a4)) {
            try {
                Result.Companion companion = Result.INSTANCE;
                e eVar = (e) a4;
                if (eVar instanceof e.a) {
                    throw ((e.a) eVar).a();
                }
                if (!(eVar instanceof e.b)) {
                    throw new NoWhenBranchMatchedException();
                }
                if (z && !StringsKt.startsWith$default(url, "https://a.appbaqend.com", false, 2, (Object) null)) {
                    List<String> list3 = ((e.b) eVar).c().get("X-Signature");
                    if (!a2.a(list3 == null ? null : (String) CollectionsKt.firstOrNull((List) list3))) {
                        throw new HttpError.RequestVerificationFailed(((e.b) eVar).b());
                    }
                }
                byte[] b = ((e.b) eVar).b();
                try {
                    Response invoke = parser.invoke(b == null ? null : com.appodeal.ads.modules.libs.network.encoders.ext.a.a(b, ((e.b) eVar).a(), this.c));
                    if (invoke != null) {
                        InternalLogKt.logInternal$default("HttpClientImpl", "<-- " + cVar.c() + "     " + cVar.d() + ", parsed model: " + invoke, null, 4, null);
                        response = invoke;
                    }
                } catch (Exception unused) {
                }
                return Result.m800constructorimpl(response);
            } catch (Throwable th) {
                Result.Companion companion2 = Result.INSTANCE;
                a4 = ResultKt.createFailure(th);
            }
        }
        return Result.m800constructorimpl(a4);
    }
}