package com.applovin.impl; import android.text.TextUtils; import androidx.core.internal.view.SupportMenu; import com.applovin.communicator.AppLovinCommunicatorMessage; import com.applovin.communicator.AppLovinCommunicatorSubscriber; import com.applovin.impl.sdk.utils.JsonUtils; import com.applovin.mediation.MaxAdFormat; import com.applovin.mediation.adapter.MaxAdViewAdapter; import com.applovin.mediation.adapter.MaxAdapter; import com.applovin.mediation.adapter.MaxAppOpenAdapter; import com.applovin.mediation.adapter.MaxInterstitialAdapter; import com.applovin.mediation.adapter.MaxNativeAdAdapter; import com.applovin.mediation.adapter.MaxRewardedAdapter; import com.applovin.mediation.adapter.MaxRewardedInterstitialAdapter; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.http.util.VersionInfo; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /* loaded from: classes.dex */ public class ke implements Comparable, AppLovinCommunicatorSubscriber { private final List A; private final List B; private final List C; private final Map D; private final boolean E; private final rn F; private final boolean G; private final String H; private final Map I; private final com.applovin.impl.sdk.j a; private final a b; private int c; private final boolean d; private final boolean f; private final boolean g; private final boolean h; private final boolean i; private final boolean j; private final boolean k; private final boolean l; private final boolean m; private final boolean n; private final String o; private final String p; private String q; private String r; private final String s; private final String t; private final String u; private final String v; private final int w; private final List x; private final List y; private final List z; public boolean A() { return this.g; } public boolean B() { return this.G; } public boolean C() { return this.n; } public boolean D() { return this.d; } public boolean F() { return this.E; } public boolean G() { return this.l; } public boolean H() { return this.m; } public String b() { return this.q; } public String c() { return this.s; } public Map d() { return this.I; } public String e() { return this.H; } public List f() { return this.z; } public String g() { return this.p; } @Override // com.applovin.communicator.AppLovinCommunicatorEntity public String getCommunicatorId() { return "MediatedNetwork"; } public int h() { return this.w; } public int i() { return this.c; } public String k() { return this.t; } public List l() { return this.B; } public String m() { return this.o; } public List n() { return this.y; } public final com.applovin.impl.sdk.j o() { return this.a; } public String p() { return this.r; } public a q() { return this.b; } public List r() { return this.x; } public List s() { return this.A; } public rn t() { return this.F; } public String toString() { return "MediatedNetwork{name=" + this.o + ", displayName=" + this.p + ", sdkAvailable=" + this.d + ", sdkVersion=" + this.r + ", adapterAvailable=" + this.f + ", adapterVersion=" + this.s + "}"; } public List u() { return this.C; } public String v() { return this.u; } public String w() { return this.v; } public Map x() { return this.D; } public boolean z() { return this.f; } public enum a { MISSING("MISSING"), INCOMPLETE_INTEGRATION("INCOMPLETE INTEGRATION"), INVALID_INTEGRATION("INVALID INTEGRATION"), COMPLETE("COMPLETE"); private final String a; /* JADX INFO: Access modifiers changed from: private */ public String b() { return this.a; } a(String str) { this.a = str; } } public enum b { NOT_SUPPORTED("Not Supported", SupportMenu.CATEGORY_MASK, "This network does not support test mode."), INVALID_INTEGRATION("Invalid Integration", SupportMenu.CATEGORY_MASK, "Please address all the integration issue(s) marked in red above."), NOT_INITIALIZED("Not Initialized", SupportMenu.CATEGORY_MASK, "Please configure this network in your MAX dashboard."), DISABLED("Enable", -16776961, "Please re-launch the app to enable test ads."), READY("", -16776961, ""); private final String a; private final int b; private final String c; public String b() { return this.c; } public String c() { return this.a; } public int d() { return this.b; } b(String str, int i, String str2) { this.a = str; this.b = i; this.c = str2; } } /* JADX WARN: Can't wrap try/catch for region: R(5:29|(4:30|31|32|33)|(6:35|36|(5:38|(2:40|(3:42|43|44))|102|43|44)(1:103)|45|46|47)|48|49) */ /* JADX WARN: Code restructure failed: missing block: B:90:0x01e7, code lost: r0 = move-exception; */ /* JADX WARN: Code restructure failed: missing block: B:91:0x01e8, code lost: r22.J(); */ /* JADX WARN: Code restructure failed: missing block: B:92:0x01ef, code lost: if (com.applovin.impl.sdk.n.a() != false) goto L59; */ /* JADX WARN: Code restructure failed: missing block: B:93:0x01f1, code lost: r22.J().a("MediatedNetwork", "Failed to check if adapter overrides MaxNativeAdAdapter", r0); */ /* JADX WARN: Code restructure failed: missing block: B:94:0x01fa, code lost: r0 = false; */ /* JADX WARN: Removed duplicated region for block: B:52:0x0236 A[ADDED_TO_REGION] */ /* JADX WARN: Removed duplicated region for block: B:56:0x024c */ /* JADX WARN: Removed duplicated region for block: B:59:0x029c */ /* JADX WARN: Removed duplicated region for block: B:62:0x02ab */ /* JADX WARN: Removed duplicated region for block: B:87:0x0258 */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public ke(org.json.JSONObject r21, com.applovin.impl.sdk.j r22) { /* Method dump skipped, instructions count: 778 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.ke.(org.json.JSONObject, com.applovin.impl.sdk.j):void"); } public b y() { if (!this.i) { return b.NOT_SUPPORTED; } a aVar = this.b; if (aVar != a.COMPLETE && (aVar != a.INCOMPLETE_INTEGRATION || !D() || !z())) { return b.INVALID_INTEGRATION; } if (!this.a.l0().c()) { return b.DISABLED; } if (this.j && (this.c == MaxAdapter.InitializationStatus.INITIALIZED_FAILURE.getCode() || this.c == MaxAdapter.InitializationStatus.INITIALIZING.getCode())) { return b.NOT_INITIALIZED; } return b.READY; } public boolean E() { return this.b == a.MISSING && this.k; } public final String j() { StringBuilder sb = new StringBuilder(); sb.append("\n---------- "); sb.append(this.o); sb.append(" ----------"); sb.append("\nStatus - "); sb.append(this.b.b()); sb.append("\nSDK - "); boolean z = this.d; String str = VersionInfo.UNAVAILABLE; sb.append((!z || TextUtils.isEmpty(this.r)) ? VersionInfo.UNAVAILABLE : this.r); sb.append("\nAdapter - "); if (this.f && !TextUtils.isEmpty(this.s)) { str = this.s; } sb.append(str); for (hh hhVar : n()) { if (!hhVar.c()) { sb.append("\n* MISSING "); sb.append(hhVar.b()); sb.append(": "); sb.append(hhVar.a()); } } for (p6 p6Var : f()) { if (!p6Var.c()) { sb.append("\n* MISSING "); sb.append(p6Var.b()); sb.append(": "); sb.append(p6Var.a()); } } return sb.toString(); } @Override // java.lang.Comparable /* renamed from: a, reason: merged with bridge method [inline-methods] */ public int compareTo(ke keVar) { return this.p.compareToIgnoreCase(keVar.p); } @Override // com.applovin.communicator.AppLovinCommunicatorSubscriber public void onMessageReceived(AppLovinCommunicatorMessage appLovinCommunicatorMessage) { String string = appLovinCommunicatorMessage.getMessageData().getString("adapter_class", ""); if (this.q.equals(string)) { this.c = appLovinCommunicatorMessage.getMessageData().getInt("init_status", 0); MaxAdapter a2 = af.a(string, this.a); if (a2 != null) { String a3 = af.a(a2); if (this.r.equals(a3)) { return; } this.r = a3; this.a.p().a(this.r, string); } } } private a a() { a aVar; if (this.d) { if (this.f) { aVar = a.COMPLETE; } else if (this.h) { aVar = a.MISSING; } else { aVar = a.INCOMPLETE_INTEGRATION; } } else if (this.f) { aVar = a.INCOMPLETE_INTEGRATION; } else { aVar = a.MISSING; } if (aVar == a.MISSING) { return aVar; } Iterator it = this.y.iterator(); while (it.hasNext()) { if (!((hh) it.next()).c()) { return a.INVALID_INTEGRATION; } } Iterator it2 = this.z.iterator(); while (it2.hasNext()) { if (!((p6) it2.next()).c()) { return a.INVALID_INTEGRATION; } } return (!this.n || com.applovin.impl.sdk.j.y0()) ? aVar : a.INVALID_INTEGRATION; } private List a(JSONObject jSONObject, String str, com.applovin.impl.sdk.j jVar) { JSONArray jSONArray = JsonUtils.getJSONArray(jSONObject, "dependencies", new JSONArray()); JSONArray jSONArray2 = JsonUtils.getJSONArray(jSONObject, "dependencies_v2", new JSONArray()); ArrayList arrayList = new ArrayList(jSONArray.length() + jSONArray2.length()); for (int i = 0; i < jSONArray.length(); i++) { JSONObject jSONObject2 = JsonUtils.getJSONObject(jSONArray, i, (JSONObject) null); if (jSONObject2 != null) { arrayList.add(new p6(jSONObject2, jVar)); } } for (int i2 = 0; i2 < jSONArray2.length(); i2++) { JSONObject jSONObject3 = JsonUtils.getJSONObject(jSONArray2, i2, (JSONObject) null); if (jSONObject3 != null && p6.a(str, JsonUtils.getString(jSONObject3, "min_adapter_version", null), JsonUtils.getString(jSONObject3, "max_adapter_version", null))) { arrayList.add(new p6(jSONObject3, jVar)); } } return arrayList; } private List a(JSONObject jSONObject, com.applovin.impl.sdk.j jVar) { ArrayList arrayList = new ArrayList(); if (this.q.equals("com.applovin.mediation.adapters.AppLovinMediationAdapter")) { hh hhVar = new hh("com.google.android.gms.permission.AD_ID", "Please add\n\nto your AndroidManifest.xml", com.applovin.impl.sdk.j.l()); if (hhVar.c()) { arrayList.add(hhVar); } } JSONObject jSONObject2 = JsonUtils.getJSONObject(jSONObject, "permissions", new JSONObject()); Iterator keys = jSONObject2.keys(); while (keys.hasNext()) { try { String next = keys.next(); arrayList.add(new hh(next, jSONObject2.getString(next), com.applovin.impl.sdk.j.l())); } catch (JSONException unused) { } } return arrayList; } private List a(MaxAdapter maxAdapter, boolean z) { ArrayList arrayList = new ArrayList(5); if (maxAdapter instanceof MaxInterstitialAdapter) { arrayList.add(MaxAdFormat.INTERSTITIAL); } if (maxAdapter instanceof MaxAppOpenAdapter) { arrayList.add(MaxAdFormat.APP_OPEN); } if (maxAdapter instanceof MaxRewardedAdapter) { arrayList.add(MaxAdFormat.REWARDED); } if (maxAdapter instanceof MaxRewardedInterstitialAdapter) { arrayList.add(MaxAdFormat.REWARDED_INTERSTITIAL); } if (maxAdapter instanceof MaxAdViewAdapter) { arrayList.add(MaxAdFormat.BANNER); arrayList.add(MaxAdFormat.LEADER); if (z) { arrayList.add(MaxAdFormat.MREC); } } if (maxAdapter instanceof MaxNativeAdAdapter) { arrayList.add(MaxAdFormat.NATIVE); } return arrayList; } private List a(JSONObject jSONObject) { return JsonUtils.optList(JsonUtils.getJSONArray(jSONObject, "supported_regions", null), null); } }