package xyz.stream.utils;

import com.google.android.gms.measurement.internal.u1;
import java.io.IOException;
import java.util.Objects;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;

/* JADX INFO: loaded from: classes3.dex */
public final class w implements Callback {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f36186a = 0;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Request f36187b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ y f36188c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ String f36189d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ z f36190e;

    public w(z zVar, String str, Request request, fe.h hVar) {
        this.f36190e = zVar;
        this.f36189d = str;
        this.f36187b = request;
        this.f36188c = hVar;
    }

    @Override // okhttp3.Callback
    public final void onFailure(Call call, IOException iOException) {
        int i10 = this.f36186a;
        String str = this.f36189d;
        y yVar = this.f36188c;
        Request request = this.f36187b;
        z zVar = this.f36190e;
        switch (i10) {
            case 0:
                f.p().y("okhttp", "upload error | " + str + " | " + iOException);
                zVar.getClass();
                z.b(request, iOException, yVar);
                break;
            default:
                zVar.getClass();
                z.b(request, iOException, yVar);
                f.p().y("okhttp", "get failed | " + str + " | " + iOException);
                break;
        }
    }

    @Override // okhttp3.Callback
    public final void onResponse(Call call, Response response) {
        int i10 = this.f36186a;
        Request request = this.f36187b;
        String str = this.f36189d;
        z zVar = this.f36190e;
        y yVar = this.f36188c;
        switch (i10) {
            case 0:
                if (!response.isSuccessful()) {
                    f fVarP = f.p();
                    StringBuilder sbN = u1.n("upload failed | ", str, " | ");
                    sbN.append(response.code());
                    sbN.append(" | ");
                    sbN.append(response.message());
                    fVarP.y("okhttp", sbN.toString());
                    Exception exc = new Exception(response.code() + " " + response.message());
                    zVar.getClass();
                    z.b(request, exc, yVar);
                } else {
                    z.a(zVar, response.body() != null ? response.body().string() : null, yVar);
                }
                break;
            default:
                if (!response.isSuccessful()) {
                    f fVarP2 = f.p();
                    StringBuilder sbN2 = u1.n("get failed | ", str, " | ");
                    sbN2.append(response.code());
                    sbN2.append(" | ");
                    sbN2.append(response.message());
                    fVarP2.y("okhttp", sbN2.toString());
                    OkHttpUtils$HttpStatusException okHttpUtils$HttpStatusException = new OkHttpUtils$HttpStatusException(response.code(), response.message());
                    zVar.getClass();
                    z.b(request, okHttpUtils$HttpStatusException, yVar);
                } else {
                    ResponseBody responseBodyBody = response.body();
                    Objects.requireNonNull(responseBodyBody);
                    z.a(zVar, responseBodyBody.string(), yVar);
                }
                break;
        }
    }

    public w(z zVar, Request request, y yVar, String str) {
        this.f36190e = zVar;
        this.f36187b = request;
        this.f36188c = yVar;
        this.f36189d = str;
    }
}
