package com.ironsource; import android.text.TextUtils; import com.ironsource.environment.ContextProvider; import com.ironsource.g2; import com.ironsource.k7; import com.ironsource.mediationsdk.IronSource; import com.ironsource.mediationsdk.adunit.adapter.internal.AdapterBaseInterface; import com.ironsource.mediationsdk.adunit.adapter.internal.AdapterSettingsInterface; import com.ironsource.mediationsdk.logger.IronLog; import java.util.List; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CopyOnWriteArrayList; /* loaded from: classes2.dex */ public class ou> { k7 d; private final List e; private final int f; pu h; ConcurrentHashMap> a = new ConcurrentHashMap<>(); private String b = ""; private String c = ""; private final Timer g = new Timer(); private final int i = 5; public class a extends TimerTask { final /* synthetic */ String a; public a(String str) { this.a = str; } @Override // java.util.TimerTask, java.lang.Runnable public void run() { try { IronLog ironLog = IronLog.INTERNAL; ironLog.verbose("removing waterfall with id " + this.a + " from memory"); ou.this.a.remove(this.a); ironLog.verbose("waterfall size is currently " + ou.this.a.size()); } finally { cancel(); } } } public ou(List list, int i, pu puVar) { this.e = list; this.f = i; this.h = puVar; } private void a() { for (Smash smash : b()) { if (!smash.equals(this.d)) { smash.M(); } } } private synchronized boolean e() { boolean z; k7 k7Var = this.d; if (k7Var != null && k7Var.C()) { z = this.d.h().equals(this.c); } return z; } public void a(g2.a aVar, CopyOnWriteArrayList copyOnWriteArrayList, String str) { IronLog ironLog = IronLog.INTERNAL; ironLog.verbose("updating new waterfall with id " + str); a(); if (aVar == g2.a.AUTOMATIC_LOAD_WHILE_SHOW || aVar == g2.a.MANUAL_WITH_LOAD_ON_SHOW) { this.a.put(str, copyOnWriteArrayList); if (!TextUtils.isEmpty(this.c)) { if (e()) { ironLog.verbose("ad from previous waterfall " + this.c + " is still showing - the current waterfall " + this.b + " will be deleted instead"); String str2 = this.b; this.b = this.c; this.c = str2; } this.g.schedule(new a(this.c), this.f); } } else { this.a.clear(); this.a.put(str, copyOnWriteArrayList); } this.c = this.b; this.b = str; if (this.a.size() > 5) { this.h.a(this.a.size()); } } public synchronized void a(k7 k7Var) { IronLog.INTERNAL.verbose(); k7 k7Var2 = this.d; if (k7Var2 != null && !k7Var2.equals(k7Var)) { this.d.M(); } } /* JADX WARN: Code restructure failed: missing block: B:31:0x003a, code lost: if (r0.e.contains(r3) == false) goto L30; */ /* JADX WARN: Code restructure failed: missing block: B:33:0x0046, code lost: if (r0.d.n().equals(r3) == false) goto L30; */ /* JADX WARN: Removed duplicated region for block: B:8:0x004b A[Catch: all -> 0x0012, TRY_LEAVE, TryCatch #0 {all -> 0x0012, blocks: (B:3:0x0001, B:8:0x004b, B:13:0x0008, B:15:0x000d, B:18:0x0014, B:20:0x0018, B:23:0x001f, B:25:0x0023, B:28:0x0030, B:30:0x0034, B:32:0x003c), top: B:2:0x0001 }] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public synchronized boolean a(com.ironsource.g2.a r1, java.lang.String r2, java.lang.String r3, com.ironsource.mediationsdk.LoadWhileShowSupportState r4, com.ironsource.mediationsdk.adunit.adapter.internal.AdapterBaseInterface r5, com.ironsource.mediationsdk.IronSource.AD_UNIT r6) { /* r0 = this; monitor-enter(r0) boolean r5 = r0.a(r5, r6, r2) // Catch: java.lang.Throwable -> L12 if (r5 == 0) goto L8 goto L48 L8: com.ironsource.g2$a r5 = com.ironsource.g2.a.AUTOMATIC_LOAD_WHILE_SHOW // Catch: java.lang.Throwable -> L12 r6 = 1 if (r1 == r5) goto L14 com.ironsource.g2$a r5 = com.ironsource.g2.a.MANUAL_WITH_LOAD_ON_SHOW // Catch: java.lang.Throwable -> L12 if (r1 == r5) goto L14 goto L49 L12: r1 = move-exception goto L63 L14: com.ironsource.k7 r1 = r0.d // Catch: java.lang.Throwable -> L12 if (r1 == 0) goto L49 boolean r1 = r1.C() // Catch: java.lang.Throwable -> L12 if (r1 != 0) goto L1f goto L49 L1f: com.ironsource.mediationsdk.LoadWhileShowSupportState r1 = com.ironsource.mediationsdk.LoadWhileShowSupportState.LOAD_WHILE_SHOW_BY_NETWORK // Catch: java.lang.Throwable -> L12 if (r4 != r1) goto L30 com.ironsource.k7 r1 = r0.d // Catch: java.lang.Throwable -> L12 java.lang.String r1 = r1.c() // Catch: java.lang.Throwable -> L12 boolean r1 = r1.equals(r2) // Catch: java.lang.Throwable -> L12 if (r1 == 0) goto L30 goto L48 L30: com.ironsource.mediationsdk.LoadWhileShowSupportState r1 = com.ironsource.mediationsdk.LoadWhileShowSupportState.NONE // Catch: java.lang.Throwable -> L12 if (r4 == r1) goto L3c java.util.List r1 = r0.e // Catch: java.lang.Throwable -> L12 boolean r1 = r1.contains(r3) // Catch: java.lang.Throwable -> L12 if (r1 == 0) goto L49 L3c: com.ironsource.k7 r1 = r0.d // Catch: java.lang.Throwable -> L12 java.lang.String r1 = r1.n() // Catch: java.lang.Throwable -> L12 boolean r1 = r1.equals(r3) // Catch: java.lang.Throwable -> L12 if (r1 == 0) goto L49 L48: r6 = 0 L49: if (r6 != 0) goto L61 com.ironsource.mediationsdk.logger.IronLog r1 = com.ironsource.mediationsdk.logger.IronLog.INTERNAL // Catch: java.lang.Throwable -> L12 java.lang.StringBuilder r3 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L12 r3.() // Catch: java.lang.Throwable -> L12 r3.append(r2) // Catch: java.lang.Throwable -> L12 java.lang.String r2 = " will not be added to the auction request" r3.append(r2) // Catch: java.lang.Throwable -> L12 java.lang.String r2 = r3.toString() // Catch: java.lang.Throwable -> L12 r1.verbose(r2) // Catch: java.lang.Throwable -> L12 L61: monitor-exit(r0) return r6 L63: monitor-exit(r0) throw r1 */ throw new UnsupportedOperationException("Method not decompiled: com.ironsource.ou.a(com.ironsource.g2$a, java.lang.String, java.lang.String, com.ironsource.mediationsdk.LoadWhileShowSupportState, com.ironsource.mediationsdk.adunit.adapter.internal.AdapterBaseInterface, com.ironsource.mediationsdk.IronSource$AD_UNIT):boolean"); } public boolean a(AdapterBaseInterface adapterBaseInterface, IronSource.AD_UNIT ad_unit, String str) { IronLog ironLog = IronLog.INTERNAL; ironLog.verbose(); if (ContextProvider.getInstance().getCurrentActiveActivity() != null || !(adapterBaseInterface instanceof AdapterSettingsInterface) || !((AdapterSettingsInterface) adapterBaseInterface).isUsingActivityBeforeImpression(ad_unit)) { return false; } ironLog.verbose(str + " - is using activity before impression and activity is null"); return true; } public List b() { CopyOnWriteArrayList copyOnWriteArrayList = this.a.get(this.b); return copyOnWriteArrayList == null ? new CopyOnWriteArrayList() : copyOnWriteArrayList; } public synchronized void b(k7 k7Var) { IronLog.INTERNAL.verbose(); this.d = k7Var; } public String c() { return this.b; } public k7 d() { return this.d; } }