package e3;

import S4.p;
import S4.w;
import i3.AbstractC2271e;
import java.io.EOFException;
import java.util.Locale;
import kotlin.jvm.internal.o;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.RequestBody$Companion$toRequestBody$2;
import okhttp3.Response;
import okhttp3.internal.http.RealInterceptorChain;
import p5.C2740j;
import w4.k;

/* JADX INFO: renamed from: e3.b, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1965b implements Interceptor {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final C1965b f16269a = new C1965b();

    @Override // okhttp3.Interceptor
    public final Response a(RealInterceptorChain realInterceptorChain) throws EOFException {
        k kVar;
        RequestBody requestBody;
        Request request = realInterceptorChain.f22388e;
        String lowerCase = request.f22125a.f22027d.toLowerCase(Locale.ROOT);
        o.g(lowerCase, "toLowerCase(...)");
        if (lowerCase.equals("www.premiumize.me")) {
            String str = request.f22126b;
            if (o.c(str, "POST") && (requestBody = request.f22128d) != null) {
                C2740j c2740j = new C2740j();
                requestBody.c(c2740j);
                byte[] bArrZ = c2740j.z(c2740j.f23100b);
                String str2 = new String(bArrZ, S4.a.f6257a);
                if (str2.length() > 500) {
                    str2 = p.m1(500, str2).concat("…");
                }
                RequestBody$Companion$toRequestBody$2 requestBody$Companion$toRequestBody$2B = RequestBody.Companion.b(RequestBody.f22136a, bArrZ, requestBody.b(), 6);
                Request.Builder builderB = request.b();
                builderB.g(str, requestBody$Companion$toRequestBody$2B);
                kVar = new k(builderB.b(), str2);
            } else {
                kVar = new k(request, null);
            }
        } else {
            kVar = new k(request, null);
        }
        Request request2 = (Request) kVar.f25469a;
        String str3 = (String) kVar.f25470b;
        HttpUrl httpUrl = request2.f22125a;
        try {
            Response responseB = realInterceptorChain.b(request2);
            if (w.t0(httpUrl.f22027d, "api.trakt.tv", true)) {
                AbstractC2271e.a(httpUrl);
                return responseB;
            }
            if (AbstractC1964a.a(httpUrl.f22027d) && str3 != null) {
                " postData=".concat(str3);
            }
            return responseB;
        } catch (Throwable th) {
            if (str3 != null) {
                " postData=".concat(str3);
            }
            throw th;
        }
    }
}
