package com.ironsource.adqualitysdk.sdk.i; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.SystemClock; import android.text.TextUtils; import android.util.TypedValue; import android.view.KeyEvent; import android.view.View; import android.view.ViewConfiguration; import com.google.firebase.perf.network.FirebasePerfUrlConnection; import com.mbridge.msdk.newreward.function.common.MBridgeCommon; import com.vungle.ads.internal.signals.SignalKey; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.Closeable; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.util.zip.GZIPOutputStream; import org.json.JSONException; import org.json.JSONObject; /* loaded from: classes4.dex */ public final class ir { /* renamed from: ﱡ, reason: contains not printable characters */ private static int f2453 = 1; /* renamed from: ﻏ, reason: contains not printable characters */ private static int f2454 = 0; /* renamed from: ﻐ, reason: contains not printable characters */ private static boolean f2455 = true; /* renamed from: ﻛ, reason: contains not printable characters */ private static boolean f2456 = true; /* renamed from: ヌ, reason: contains not printable characters */ private static int f2458 = 292; /* renamed from: メ, reason: contains not printable characters */ private static char[] f2459 = {370, 393, 408, 377, 397, 400, 407, 361, 406, 403, 324, 402, 392, 395, 405, 409, 350, 376, 362, 337, 348, 414, 404, 389, 391, 339, 398, 351, 396, 353, 394, 363, 336, 326}; /* renamed from: k, reason: contains not printable characters */ private static long f2457 = -969344515158747502L; /* renamed from: ﻐ, reason: contains not printable characters */ public static iq m3047(JSONObject jSONObject, String str) { try { HttpURLConnection m3051 = m3051(str); byte[] m3060 = m3060(m3051, jSONObject); long m3254 = jp.m3254(); m3054(m3051, m3060); String m3049 = m3049(m3051); int responseCode = m3051.getResponseCode(); String responseMessage = m3051.getResponseMessage(); if (responseCode >= 400) { int i = f2454 + 33; f2453 = i % 128; int i2 = i % 2; m3051.disconnect(); int i3 = f2453 + 123; f2454 = i3 % 128; int i4 = i3 % 2; } return new iq(m3049, responseCode, responseMessage, jp.m3254() - m3254); } catch (Throwable th) { String intern = m3057(null, null, 127 - (ViewConfiguration.getMaximumFlingVelocity() >> 16), "\u0087\u0086\u0085\u0083\u0084\u0083\u0082\u0081").intern(); StringBuilder sb = new StringBuilder(); sb.append(m3056("틼특쏨ꎑ锈\ue6b9\u0ec7\ue560裆猒\ua48e묢昂좮쉌庑\udc43ꚢ\u181d\uf458뮯簮뗵訝ᇱ\uda63퍨⇂켿럞楿쟿", Color.red(0)).intern()); sb.append(th.getLocalizedMessage()); l.m3428(intern, sb.toString(), th); return null; } } /* renamed from: k, reason: contains not printable characters */ public static iq m3052(String str) { try { HttpURLConnection m3050 = m3050(str); long m3254 = jp.m3254(); String m3049 = m3049(m3050); int responseCode = m3050.getResponseCode(); String responseMessage = m3050.getResponseMessage(); if (responseCode >= 400) { int i = f2454 + 97; f2453 = i % 128; int i2 = i % 2; m3050.disconnect(); int i3 = f2453 + 115; f2454 = i3 % 128; int i4 = i3 % 2; } return new iq(m3049, responseCode, responseMessage, jp.m3254() - m3254); } catch (Throwable th) { String intern = m3057(null, null, 127 - KeyEvent.keyCodeFromString(""), "\u0087\u0086\u0085\u0083\u0084\u0083\u0082\u0081").intern(); StringBuilder sb = new StringBuilder(); sb.append(m3057(null, null, View.resolveSize(0, 0) + 127, "\u008b\u0091\u0083\u0087\u0082\u0090\u008f\u0082\u0089\u008b\u0083\u0082\u008e\u008b\u008e\u008c\u0085\u008d\u008c\u0082\u0087\u008b\u0089\u008a\u0089\u0089\u0088").intern()); sb.append(th.getLocalizedMessage()); l.m3428(intern, sb.toString(), th); return null; } } /* renamed from: k, reason: contains not printable characters */ private static void m3054(HttpURLConnection httpURLConnection, byte[] bArr) throws IOException { httpURLConnection.connect(); DataOutputStream dataOutputStream = new DataOutputStream(httpURLConnection.getOutputStream()); dataOutputStream.write(bArr); dataOutputStream.flush(); m3058(dataOutputStream); int i = f2453 + 125; f2454 = i % 128; int i2 = i % 2; } /* renamed from: メ, reason: contains not printable characters */ private static byte[] m3060(HttpURLConnection httpURLConnection, JSONObject jSONObject) throws JSONException, UnsupportedEncodingException { String intern; int i; byte[] bytes = m3053(jSONObject).getBytes(m3057(null, null, View.MeasureSpec.getMode(0) + 127, "\u0095\u0094\u0093\u0092\u0084").intern()); if (!(!m3059(r11))) { int i2 = f2454 + 37; f2453 = i2 % 128; if (i2 % 2 == 0) { SystemClock.uptimeMillis(); intern = m3056("\ud82a\ud869沭\u0ffc㩐ᳵꊶἷ與\udc19ࣤ䄦泿柡渫ꓜ횖ম둮ผ", 0).intern(); i = 106 >> (ViewConfiguration.getScrollFriction() > 2.0f ? 1 : (ViewConfiguration.getScrollFriction() == 2.0f ? 0 : -1)); } else { intern = m3056("\ud82a\ud869沭\u0ffc㩐ᳵꊶἷ與\udc19ࣤ䄦泿柡渫ꓜ횖ম둮ผ", 1 - (SystemClock.uptimeMillis() > 0L ? 1 : (SystemClock.uptimeMillis() == 0L ? 0 : -1))).intern(); i = (ViewConfiguration.getScrollFriction() > 0.0f ? 1 : (ViewConfiguration.getScrollFriction() == 0.0f ? 0 : -1)) + 126; } httpURLConnection.setRequestProperty(intern, m3057(null, null, i, "\u0097\u0085\u0096\u008e").intern()); bytes = m3055(bytes); } int i3 = f2454 + 61; f2453 = i3 % 128; int i4 = i3 % 2; return bytes; } /* renamed from: ﻛ, reason: contains not printable characters */ private static HttpURLConnection m3051(String str) throws IOException { HttpURLConnection httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(new URL(str).openConnection())); httpURLConnection.setRequestMethod(m3056("!q끣⇁\ue6be쪔貶쥶", (ViewConfiguration.getScrollFriction() > 0.0f ? 1 : (ViewConfiguration.getScrollFriction() == 0.0f ? 0 : -1)) - 1).intern()); httpURLConnection.setRequestProperty(m3056("갖걕Ꮱ뢕䔜쿁ᗟ찃\uf63bꍕ뾍鈒ᣒᢺ\ud951矢", KeyEvent.getMaxKeyCode() >> 16).intern(), m3057(null, null, 128 - (ViewConfiguration.getGlobalActionKeyTimeout() > 0L ? 1 : (ViewConfiguration.getGlobalActionKeyTimeout() == 0L ? 0 : -1)), "\u0095\u0094\u009f\u0083\u0090\u009e\u0083\u0082\u0087\u0089\u0098\u009d\u0099\u008b\u009c\u008c\u008a\u0087\u009b\u009a\u008c\u008a\u0085\u0083\u0098\u0099\u0085\u0086\u0097\u0097\u0098").intern()); httpURLConnection.setUseCaches(false); httpURLConnection.setDoInput(true); httpURLConnection.setDoOutput(true); httpURLConnection.setConnectTimeout(MBridgeCommon.DEFAULT_LOAD_TIMEOUT); httpURLConnection.setReadTimeout(MBridgeCommon.DEFAULT_LOAD_TIMEOUT); int i = f2453 + 17; f2454 = i % 128; int i2 = i % 2; return httpURLConnection; } /* renamed from: ﻐ, reason: contains not printable characters */ private static HttpURLConnection m3050(String str) throws IOException { HttpURLConnection httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(new URL(str).openConnection())); httpURLConnection.setRequestMethod(m3057(null, null, (TypedValue.complexToFraction(0, 0.0f, 0.0f) > 0.0f ? 1 : (TypedValue.complexToFraction(0, 0.0f, 0.0f) == 0.0f ? 0 : -1)) + 127, "\u0092\u0088 ").intern()); int i = f2454 + 77; f2453 = i % 128; if (i % 2 != 0) { return httpURLConnection; } throw null; } /* renamed from: ﻐ, reason: contains not printable characters */ private static String m3049(HttpURLConnection httpURLConnection) { InputStream inputStream; BufferedReader bufferedReader; String str = null; try { inputStream = httpURLConnection.getInputStream(); try { bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); } catch (Throwable th) { th = th; bufferedReader = null; } } catch (Throwable th2) { th = th2; inputStream = null; bufferedReader = null; } try { StringBuffer stringBuffer = new StringBuffer(); while (true) { String readLine = bufferedReader.readLine(); if (readLine == null) { break; } int i = f2454 + 53; f2453 = i % 128; int i2 = i % 2; if (stringBuffer.length() > 0) { int i3 = f2454 + 119; f2453 = i3 % 128; if (i3 % 2 == 0) { stringBuffer.append('['); } else { stringBuffer.append('\r'); } } stringBuffer.append(readLine); } str = stringBuffer.toString(); } catch (Throwable th3) { th = th3; try { l.m3428(m3057(null, null, Drawable.resolveOpacity(0, 0) + 127, "\u0087\u0086\u0085\u0083\u0084\u0083\u0082\u0081").intern(), m3057(null, null, TextUtils.lastIndexOf("", '0', 0) + 128, "\u0082\u0087\u008c\u008a\u0097\u0087\u0082\u0089\u008b\u008e\u008c\u0085\u0083\u0083\u0082\u008e\u008b\u0089\u008a\u0089\u0089\u0088").intern(), th); return str; } finally { m3058(inputStream); m3058(bufferedReader); } } return str; } /* renamed from: ヌ, reason: contains not printable characters */ private static void m3058(Closeable closeable) { int i = f2454 + 47; f2453 = i % 128; try { if (i % 2 == 0) { throw null; } if (closeable != null) { closeable.close(); int i2 = f2454 + 99; f2453 = i2 % 128; int i3 = i2 % 2; } int i4 = f2453 + 39; f2454 = i4 % 128; if (i4 % 2 != 0) { throw null; } } catch (Throwable unused) { } } /* renamed from: メ, reason: contains not printable characters */ private static boolean m3059(String str) { int i = f2454 + 89; f2453 = i % 128; int i2 = i % 2; int length = str.length(); if (i2 == 0) { if (length <= 13404) { return false; } } else if (length <= 256) { return false; } int i3 = f2453 + SignalKey.EVENT_ID; f2454 = i3 % 128; int i4 = i3 % 2; return true; } /* renamed from: k, reason: contains not printable characters */ private static byte[] m3055(byte[] bArr) { ByteArrayOutputStream byteArrayOutputStream; GZIPOutputStream gZIPOutputStream; GZIPOutputStream gZIPOutputStream2 = null; try { try { byteArrayOutputStream = new ByteArrayOutputStream(); gZIPOutputStream = new GZIPOutputStream(byteArrayOutputStream); } catch (Throwable th) { th = th; } } catch (Exception e) { e = e; } try { gZIPOutputStream.write(bArr); gZIPOutputStream.flush(); gZIPOutputStream.close(); byte[] byteArray = byteArrayOutputStream.toByteArray(); int i = f2453 + 115; f2454 = i % 128; int i2 = i % 2; return byteArray; } catch (Exception e2) { e = e2; throw new RuntimeException(e); } catch (Throwable th2) { th = th2; gZIPOutputStream2 = gZIPOutputStream; if (gZIPOutputStream2 != null) { try { gZIPOutputStream2.close(); int i3 = f2453 + 51; f2454 = i3 % 128; int i4 = i3 % 2; } catch (Exception unused) { } } throw th; } } /* renamed from: k, reason: contains not printable characters */ private static String m3053(JSONObject jSONObject) { String jSONObject2 = jSONObject.toString(); String m3309 = jv.m3309(jSONObject2); String substring = jSONObject2.substring(0, jSONObject2.lastIndexOf(125)); StringBuilder sb = new StringBuilder(); sb.append(substring); sb.append(m3057(null, null, (ViewConfiguration.getLongPressTimeout() >> 16) + 127, "¢\u0091¢\u0087\u009d¢¡").intern()); sb.append(m3309); sb.append(m3056("\uf245\uf267驐\u0c54첿렌", Color.red(0)).intern()); String obj = sb.toString(); int i = f2454 + 97; f2453 = i % 128; int i2 = i % 2; return obj; } /* renamed from: ﻐ, reason: contains not printable characters */ public static String m3048(iq iqVar) { if (iqVar == null) { int i = f2453 + 25; f2454 = i % 128; int i2 = i % 2; return null; } String m3042 = iqVar.m3042(); int i3 = f2454 + 111; f2453 = i3 % 128; int i4 = i3 % 2; return m3042; } /* renamed from: ヌ, reason: contains not printable characters */ private static String m3057(String str, int[] iArr, int i, String str2) { byte[] bArr = str2; if (str2 != null) { bArr = str2.getBytes("ISO-8859-1"); } byte[] bArr2 = bArr; char[] cArr = str; if (str != null) { cArr = str.toCharArray(); } char[] cArr2 = cArr; synchronized (o.f2842) { try { char[] cArr3 = f2459; int i2 = f2458; if (f2455) { int length = bArr2.length; o.f2841 = length; char[] cArr4 = new char[length]; o.f2840 = 0; while (o.f2840 < o.f2841) { int i3 = o.f2840; int i4 = o.f2841 - 1; int i5 = o.f2840; cArr4[i3] = (char) (cArr3[bArr2[i4 - i5] + i] - i2); o.f2840 = i5 + 1; } return new String(cArr4); } if (f2456) { int length2 = cArr2.length; o.f2841 = length2; char[] cArr5 = new char[length2]; o.f2840 = 0; while (o.f2840 < o.f2841) { int i6 = o.f2840; int i7 = o.f2841 - 1; int i8 = o.f2840; cArr5[i6] = (char) (cArr3[cArr2[i7 - i8] - i] - i2); o.f2840 = i8 + 1; } return new String(cArr5); } int length3 = iArr.length; o.f2841 = length3; char[] cArr6 = new char[length3]; o.f2840 = 0; while (o.f2840 < o.f2841) { int i9 = o.f2840; int i10 = o.f2841 - 1; int i11 = o.f2840; cArr6[i9] = (char) (cArr3[iArr[i10 - i11] - i] - i2); o.f2840 = i11 + 1; } return new String(cArr6); } catch (Throwable th) { throw th; } } } /* renamed from: ヌ, reason: contains not printable characters */ private static String m3056(String str, int i) { String str2; char[] cArr = str; if (str != null) { cArr = str.toCharArray(); } char[] cArr2 = cArr; synchronized (i.f2325) { try { char[] m2999 = i.m2999(f2457, cArr2, i); i.f2324 = 4; while (true) { int i2 = i.f2324; if (i2 < m2999.length) { i.f2323 = i2 - 4; m2999[i.f2324] = (char) ((m2999[r1] ^ m2999[r1 % 4]) ^ (i.f2323 * f2457)); i.f2324++; } else { str2 = new String(m2999, 4, m2999.length - 4); } } } catch (Throwable th) { throw th; } } return str2; } }