package o; import android.text.TextUtils; import java.util.List; import java.util.NoSuchElementException; import o.InterfaceC9010dbe; import o.ZI; import o.cLE; import o.wRi; /* loaded from: classes4.dex */ public class cLE extends ZI { public boolean a; String b; private C1171Xc c; private List d; private final CY e; private boolean g; private final RyF i; @InterfaceC13391fZD public cLE(RyF ryF, CY cy, C16903sI c16903sI) { super(c16903sI); this.g = false; this.a = false; this.i = ryF; this.e = cy; } /* loaded from: classes4.dex */ public final class RVV extends wRi.LWm> { private cLE a; private boolean b; private boolean c; private String d; /* JADX WARN: Multi-variable type inference failed */ @Override // o.wRi.LWm, o.InterfaceC13174fSv public final /* synthetic */ void onNext(Object obj) { zEQ d; C17480xBa c17480xBa; C15413gpp e; List list = (List) obj; if (this.a.f != 0) { if (list != null && !list.isEmpty()) { cLE.j(this.a); this.a.d = list; YKU yku = new YKU(this.a.d); YKU yku2 = new YKU(yku.a, new GEP(yku.b, new Jel(this) { // from class: o.cLM private cLE.RVV a; @Override // o.Jel public final boolean e(Object obj2) { boolean equals; equals = ((C17480xBa) obj2).b.equals(this.a.a.b); return equals; } { this.a = this; } })); if (yku2.b.hasNext()) { d = zEQ.a(yku2.b.next()); } else { d = zEQ.d(); } if (d.d != 0) { T t = d.d; if (t != 0) { c17480xBa = (C17480xBa) t; } else { throw new NoSuchElementException("No value present"); } } else { c17480xBa = null; } String str = c17480xBa != null ? c17480xBa.b : null; List a = this.a.e.a(list, this.a.i.b.T(), this.c); if (this.b) { str = this.d; } int i = 0; if (!TextUtils.isEmpty(str)) { rgl a2 = rgl.a(this.a.d.size()); rgl rglVar = new rgl(a2.b, new C0793Oqj(a2.d, new MSP(a, str) { // from class: o.cLP private List a; private String b; @Override // o.MSP public final boolean b(int i2) { boolean equals; equals = ((WW) this.a.get(i2)).s.equals(this.b); return equals; } { this.a = a; this.b = str; } })); if (rglVar.d.hasNext()) { e = C15413gpp.b(rglVar.d.e()); } else { e = C15413gpp.e(); } if (e.e) { if (!e.e) { throw new NoSuchElementException("No value present"); } i = e.c; } } cLE cle = this.a; ZI.IeS ieS = new ZI.IeS(a, i) { // from class: o.cLG private List a; private int c; @Override // o.ZI.IeS public final void e(Object obj2) { InterfaceC9010dbe.HBt hBt = (InterfaceC9010dbe.HBt) obj2; hBt.c((List) this.a, this.c); } { this.a = a; this.c = i; } }; if (cle.f != 0) { ieS.e(cle.f); return; } return; } if (this.b) { cLE cle2 = this.a; cLN cln = new cLN(); if (cle2.f != 0) { cln.e(cle2.f); } } cLE cle3 = this.a; ZI.IeS ieS2 = new ZI.IeS(this) { // from class: o.cLL private cLE.RVV e; @Override // o.ZI.IeS public final void e(Object obj2) { ((InterfaceC9010dbe.HBt) obj2).b_(this.e.a.c.c); } { this.e = this; } }; if (cle3.f != 0) { ieS2.e(cle3.f); } } } RVV(cLE cle, boolean z) { this(cle, null, false, z); } RVV(cLE cle, String str, boolean z, boolean z2) { this.a = cle; this.d = str; this.b = z; this.c = z2; } @Override // o.wRi.LWm, o.InterfaceC13174fSv public final void onComplete() { cLE.g(this.a); } @Override // o.wRi.LWm, o.InterfaceC13174fSv public final void onError(Throwable th) { if (this.a.i(th) || this.a.f == 0) { return; } if (this.b) { cLE cle = this.a; cLN cln = new cLN(); if (cle.f != 0) { cln.e(cle.f); } } cLE.i(this.a); String str = this.a.b; if (str == null || str.isEmpty()) { cLE cle2 = this.a; ZI.IeS ieS = new ZI.IeS() { // from class: o.cLF @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC9010dbe.HBt) obj).aM_(); } }; if (cle2.f != 0) { ieS.e(cle2.f); } } } } public static /* synthetic */ void d(cLE cle, String str, InterfaceC9010dbe.HBt hBt) { hBt.c(str, cle.c.c); } static /* synthetic */ void g(cLE cle) { if (cle.f != 0) { cle.f.aq_(); } } static /* synthetic */ void i(cLE cle) { if (cle.f != 0) { cle.f.aq_(); } } static /* synthetic */ void j(cLE cle) { if (cle.f != 0) { cle.f.aq_(); } } public final void c(String str) { if (this.f != 0) { this.f.v(); } ZI.IeS ieS = new ZI.IeS() { // from class: o.cLC @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC9010dbe.HBt) obj).a(); } }; if (this.f != 0) { ieS.e(this.f); } this.i.d(this.c.e.toString()); RyF ryF = this.i; ryF.d(ryF.i, new RVV(this, str, true, this.g)); } public final void e(C1171Xc c1171Xc, String str, boolean z, boolean z2) { this.c = c1171Xc; this.g = z; this.a = z2; if (this.f != 0) { this.f.v(); } if (!c1171Xc.a) { if (gjJ.b((CharSequence) str)) { RyF ryF = this.i; str = ryF.b.d(this.c.e.toString()); } this.b = str; } else { RyF ryF2 = this.i; this.b = ryF2.b.b(this.c.e.toString()); } this.i.e(this.c.e.toString()); RyF ryF3 = this.i; ryF3.d(ryF3.i, new RVV(this, z)); ZI.IeS ieS = new ZI.IeS(c1171Xc) { // from class: o.cLK private C1171Xc c; @Override // o.ZI.IeS public final void e(Object obj) { ((InterfaceC9010dbe.HBt) obj).c(this.c); } { this.c = c1171Xc; } }; if (this.f != 0) { ieS.e(this.f); } } }