package X; import android.net.Uri; import com.bytedance.covode.number.Covode; import java.nio.charset.Charset; import java.security.MessageDigest; import java.util.List; import java.util.Map; import kotlin.g.b.m; import okhttp3.Request; import org.json.JSONArray; import org.json.JSONObject; /* renamed from: X.Eok reason: case insensitive filesystem */ public final class C37541Eok<T> extends AbstractC37529EoY<T> { public final C37607Epo LIZIZ; public final C37540Eoj LIZJ; public String LIZLLL; public final String LJ; public final AbstractC37543Eom<T> LJFF; static { Covode.recordClassIndex(121015); } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public C37541Eok(C37522EoR eoR, C37607Epo epo, C37540Eoj eoj, String str, String str2, AbstractC37543Eom<T> eom) { super(eoR); C21090sc.LIZ(eoR, epo, eoj, str, str2); this.LIZIZ = epo; this.LIZJ = eoj; this.LIZLLL = str; this.LJ = str2; this.LJFF = eom; } @Override // X.AbstractC37529EoY public final T LIZ(C37516EoL eoL) { String str; List<String> queryParameters; C21090sc.LIZ(eoL); if (eoL.LIZ.length() > 0 && eoL.LIZIZ.length() > 0) { this.LIZJ.LIZ("captcha_sid", eoL.LIZ).LIZ("captcha_key", eoL.LIZIZ); } if (eoL.LIZJ) { this.LIZJ.LIZ("confirm", "1"); } String LIZ = this.LIZJ.LIZ("device_id"); if (LIZ == null) { LIZ = ""; } if (AnonymousClass1ZS.LIZ((CharSequence) LIZ)) { LIZ = this.LIZLLL; } C37540Eoj eoj = this.LIZJ; if (LIZ != null) { String lowerCase = LIZ.toLowerCase(); m.LIZ((Object) lowerCase, ""); eoj.LIZ("device_id", lowerCase); String LIZ2 = this.LIZJ.LIZ("lang"); if (LIZ2 == null) { LIZ2 = ""; } if (AnonymousClass1ZS.LIZ((CharSequence) LIZ2)) { LIZ2 = this.LJ; } C37540Eoj eoj2 = this.LIZJ; if (LIZ2 != null) { String lowerCase2 = LIZ2.toLowerCase(); m.LIZ((Object) lowerCase2, ""); eoj2.LIZ("lang", lowerCase2); C37539Eoi LIZ3 = this.LIZJ.LIZ(); C21090sc.LIZ(LIZ3); C37607Epo epo = this.LIZIZ; C21090sc.LIZ(LIZ3); C21090sc.LIZ(LIZ3); String str2 = epo.LIZLLL; C21090sc.LIZ(LIZ3); String str3 = epo.LJ; C87213by r10 = C87213by.LIZIZ; int i2 = epo.LJFF.LIZ.LIZIZ; C21090sc.LIZ(LIZ3); String str4 = LIZ3.LIZ; String str5 = LIZ3.LIZIZ; Map<String, String> map = LIZ3.LIZJ; C21090sc.LIZ(str4, str5, map); if (str3 == null || str3.length() == 0) { str = r10.LIZ(str5, map, str2, i2, true); } else { String str6 = "/method/" + str4 + '?' + r10.LIZ(str5, map, str2, i2, false) + str3; MessageDigest instance = MessageDigest.getInstance("MD5"); Charset charset = C23650wk.LIZ; if (str6 != null) { byte[] bytes = str6.getBytes(charset); m.LIZ((Object) bytes, ""); byte[] digest = instance.digest(bytes); m.LIZ((Object) digest, ""); str = r10.LIZ(str5, map, str2, i2, true) + "&sig=" + AnonymousClass1YG.LIZ(digest, "", "", "", "...", (AnonymousClass1IM<? super Byte, ? extends CharSequence>) C60162Yr.LIZ); } else { throw new C23830x2("null cannot be cast to non-null type java.lang.String"); } } C24780yZ LIZIZ2 = C24780yZ.LIZIZ("application/x-www-form-urlencoded; charset=utf-8"); C21090sc.LIZ(LIZ3, str); if (AnonymousClass1ZS.LIZIZ(LIZ3.LIZ, "execute.", false)) { Uri parse = Uri.parse("https://vk.com/?".concat(String.valueOf(str))); if (parse.getQueryParameters("method").contains("execute") && (queryParameters = parse.getQueryParameters("code")) != null && !queryParameters.isEmpty()) { throw new C37517EoM(15, LIZ3.LIZ, false, "Hey dude don't execute your hacky code ;)", null, null, null, 112, null); } } C24600yH LIZ4 = new C24600yH().LIZ(AbstractC24610yI.LIZ(LIZIZ2, str)).LIZ("https://" + epo.LIZJ + "/method/" + LIZ3.LIZ).LIZ(C24660yN.LIZ); C37542Eol eol = LIZ3.LIZLLL; Request LIZ5 = LIZ4.LIZ(Map.class, eol != null ? AnonymousClass1YE.LIZIZ(C23820x1.LIZ("UID", eol.LIZ), C23820x1.LIZ("AWAIT_NETWORK", eol.LIZIZ), C23820x1.LIZ("REASON", eol.LIZJ), C23820x1.LIZ("RETRY_COUNT", eol.LIZLLL)) : null).LIZ(); m.LIZ((Object) LIZ5, ""); C21090sc.LIZ(LIZ5); long j = epo.LJFF.LIZ.LJI; C21090sc.LIZ(LIZ5); C24630yK LIZIZ3 = epo.LIZ(j).LIZ(LIZ5).LIZIZ(); m.LIZ((Object) LIZIZ3, ""); String LIZ6 = epo.LIZ(LIZIZ3); String str7 = LIZ3.LIZ; C21090sc.LIZ(str7); if (LIZ6 != null) { C21090sc.LIZ(LIZ6); C21090sc.LIZ(LIZ6); if (!FQG.LIZ.LIZ(LIZ6, "error")) { C21090sc.LIZ(LIZ6); C21090sc.LIZ(LIZ6); if (!FQG.LIZ.LIZ(LIZ6, "execute_errors")) { AbstractC37543Eom<T> eom = this.LJFF; if (eom != null) { return eom.LIZ(LIZ6); } return null; } C21090sc.LIZ(LIZ6, str7); C37518EoN eoN = C37518EoN.LIZ; C21090sc.LIZ(LIZ6, str7); JSONArray jSONArray = new JSONObject(LIZ6).getJSONArray("execute_errors"); m.LIZ((Object) jSONArray, ""); throw eoN.LIZ(jSONArray, str7); } C21090sc.LIZ(LIZ6); C37518EoN eoN2 = C37518EoN.LIZ; C21090sc.LIZ(LIZ6); JSONObject optJSONObject = new JSONObject(LIZ6).optJSONObject("error"); m.LIZ((Object) optJSONObject, ""); throw eoN2.LIZ(optJSONObject, str7); } throw new C37533Eoc("Response returned null instead of valid string response"); } throw new C23830x2("null cannot be cast to non-null type java.lang.String"); } throw new C23830x2("null cannot be cast to non-null type java.lang.String"); } }