package com.ironsource; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Set; import kotlin.NoWhenBranchMatchedException; import kotlin.collections.CollectionsKt__IterablesKt; import kotlin.collections.CollectionsKt___CollectionsKt; import kotlin.jvm.internal.Intrinsics; import kotlin.jvm.internal.SourceDebugExtension; import org.json.JSONArray; @SourceDebugExtension({"SMAP\nAdvertiserBundleHistoryService.kt\nKotlin\n*S Kotlin\n*F\n+ 1 AdvertiserBundleHistoryService.kt\ncom/ironsource/services/sessionhistory/services/AdvertiserBundleHistoryService\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,47:1\n1549#2:48\n1620#2,3:49\n1549#2:52\n1620#2,3:53\n766#2:56\n857#2,2:57\n766#2:59\n857#2,2:60\n1549#2:62\n1620#2,3:63\n766#2:66\n857#2,2:67\n*S KotlinDebug\n*F\n+ 1 AdvertiserBundleHistoryService.kt\ncom/ironsource/services/sessionhistory/services/AdvertiserBundleHistoryService\n*L\n19#1:48\n19#1:49,3\n21#1:52\n21#1:53,3\n26#1:56\n26#1:57,2\n33#1:59\n33#1:60,2\n37#1:62\n37#1:63,3\n41#1:66\n41#1:67,2\n*E\n"}) /* loaded from: classes2.dex */ public final class a3 implements wr { private final List a = new ArrayList(); public /* synthetic */ class a { public static final /* synthetic */ int[] a; static { int[] iArr = new int[vr.values().length]; try { iArr[vr.FullHistory.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { iArr[vr.CurrentlyLoadedAds.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } a = iArr; } } private final List a() { Set set; List list = this.a; ArrayList arrayList = new ArrayList(); for (Object obj : list) { z2 z2Var = (z2) obj; if (z2Var.e() != tr.LoadSuccess && z2Var.e() != tr.LoadRequest) { arrayList.add(obj); } } ArrayList arrayList2 = new ArrayList(CollectionsKt__IterablesKt.collectionSizeOrDefault(arrayList, 10)); Iterator it = arrayList.iterator(); while (it.hasNext()) { arrayList2.add(((z2) it.next()).a()); } set = CollectionsKt___CollectionsKt.toSet(arrayList2); List list2 = this.a; ArrayList arrayList3 = new ArrayList(); for (Object obj2 : list2) { z2 z2Var2 = (z2) obj2; if (z2Var2.e() == tr.LoadSuccess && !set.contains(z2Var2.a())) { arrayList3.add(obj2); } } return arrayList3; } private final List b() { List list = this.a; ArrayList arrayList = new ArrayList(); for (Object obj : list) { if (((z2) obj).e() != tr.LoadRequest) { arrayList.add(obj); } } return arrayList; } public final void a(z2 event) { Intrinsics.checkNotNullParameter(event, "event"); this.a.add(event); } @Override // com.ironsource.od /* renamed from: b, reason: merged with bridge method [inline-methods] */ public JSONArray a(vr mode) { Intrinsics.checkNotNullParameter(mode, "mode"); int i = a.a[mode.ordinal()]; if (i == 1) { List b = b(); ArrayList arrayList = new ArrayList(CollectionsKt__IterablesKt.collectionSizeOrDefault(b, 10)); Iterator it = b.iterator(); while (it.hasNext()) { arrayList.add(((z2) it.next()).d()); } return new JSONArray((Collection) arrayList); } if (i != 2) { throw new NoWhenBranchMatchedException(); } List a2 = a(); ArrayList arrayList2 = new ArrayList(CollectionsKt__IterablesKt.collectionSizeOrDefault(a2, 10)); Iterator it2 = a2.iterator(); while (it2.hasNext()) { arrayList2.add(((z2) it2.next()).c()); } return new JSONArray((Collection) arrayList2); } }