package com.applovin.impl; import android.content.Context; import android.text.SpannedString; import android.text.TextUtils; import androidx.core.view.ViewCompat; import com.applovin.impl.sdk.utils.StringUtils; import java.util.ArrayList; import java.util.List; /* loaded from: classes.dex */ class y extends ec { private final z f; private final a0 g; private final ir h; private final String i; private final List j; private final List k; private final List l; public enum a { INFO, BIDDERS, WATERFALL, COUNT } private dc f() { return dc.a().d("AB Test Experiment Name").c(j().b()).a(); } private dc g() { return dc.a().d("ID").c(this.f.c()).a(); } private dc i() { return dc.a().d("Selected Network").c(this.h.b().a()).a(); } @Override // com.applovin.impl.ec public int b() { return a.COUNT.ordinal(); } public a0 j() { return this.g; } public String k() { return this.i; } public y(z zVar, a0 a0Var, ir irVar, Context context) { super(context); this.f = zVar; this.h = irVar; this.g = a0Var != null ? a0Var : zVar.f(); this.i = a0Var != null ? a0Var.c() : zVar.d(); this.j = h(); this.k = e(); this.l = l(); notifyDataSetChanged(); } @Override // com.applovin.impl.ec public int d(int i) { if (i == a.INFO.ordinal()) { return this.j.size(); } if (i == a.BIDDERS.ordinal()) { return this.k.size(); } return this.l.size(); } private dc d() { return dc.a().d("Ad Format").c(this.f.b()).a(); } @Override // com.applovin.impl.ec public List c(int i) { return i == a.INFO.ordinal() ? this.j : i == a.BIDDERS.ordinal() ? this.k : this.l; } private List h() { ArrayList arrayList = new ArrayList(2); arrayList.add(g()); arrayList.add(d()); if (this.g.b() != null) { arrayList.add(f()); } if (this.h != null) { arrayList.add(i()); } return arrayList; } private List e() { ir irVar = this.h; if (irVar != null && !irVar.d()) { return new ArrayList(); } List a2 = this.g.a(); ArrayList arrayList = new ArrayList(a2.size()); for (ir irVar2 : a2) { ir irVar3 = this.h; if (irVar3 == null || irVar3.b().c().equals(irVar2.b().c())) { arrayList.add(new b(irVar2, irVar2.a() != null ? irVar2.a().a() : "", this.h == null)); } } return arrayList; } private List l() { ir irVar = this.h; if (irVar != null && irVar.d()) { return new ArrayList(); } List e = this.g.e(); ArrayList arrayList = new ArrayList(e.size()); for (ir irVar2 : e) { ir irVar3 = this.h; if (irVar3 == null || irVar3.b().c().equals(irVar2.b().c())) { arrayList.add(new b(irVar2, null, this.h == null)); for (dg dgVar : irVar2.c()) { arrayList.add(dc.a().d(dgVar.a()).c(dgVar.b()).b(true).a()); } } } return arrayList; } public class b extends cg { private final ir p; @Override // com.applovin.impl.dc public int g() { return -12303292; } @Override // com.applovin.impl.cg, com.applovin.impl.dc public boolean o() { return this.b; } public ir v() { return this.p; } public b(ir irVar, String str, boolean z) { super(irVar.b().d(), y.this.a); this.p = irVar; this.c = StringUtils.createSpannedString(irVar.b().a(), ViewCompat.MEASURED_STATE_MASK, 18, 1); this.d = !TextUtils.isEmpty(str) ? new SpannedString(str) : null; this.b = z; } } @Override // com.applovin.impl.ec public dc e(int i) { if (i == a.INFO.ordinal()) { return new fj("INFO"); } if (i == a.BIDDERS.ordinal()) { return new fj("BIDDERS"); } return new fj("WATERFALL"); } }