package o; import java.util.Collection; import java.util.Objects; /* loaded from: classes6.dex */ public final class fVH extends fUX { private fSS b; private InterfaceC13189fTc> e; public fVH(InterfaceC13169fSq interfaceC13169fSq, fSS fss, InterfaceC13189fTc> interfaceC13189fTc) { super(interfaceC13169fSq); this.b = fss; this.e = interfaceC13189fTc; } @Override // o.AbstractC13163fSk public final void subscribeActual(InterfaceC13174fSv interfaceC13174fSv) { try { this.c.subscribe(new Sts(interfaceC13174fSv, this.b, (Collection) fYR.d(this.e.d(), "The collectionSupplier returned a null Collection."))); } catch (Throwable th) { C13147fSI.c(th); EnumC13195fTi.a(th, interfaceC13174fSv); } } /* loaded from: classes6.dex */ static final class Sts extends fTA { private Collection a; private fSS i; Sts(InterfaceC13174fSv interfaceC13174fSv, fSS fss, Collection collection) { super(interfaceC13174fSv); this.i = fss; this.a = collection; } @Override // o.InterfaceC13174fSv public final void onNext(T t) { if (this.c) { return; } if (this.b == 0) { try { if (this.a.add(Objects.requireNonNull(this.i.a(t), "The keySelector returned a null key"))) { this.d.onNext(t); return; } return; } catch (Throwable th) { b(th); return; } } this.d.onNext(null); } @Override // o.fTA, o.InterfaceC13174fSv public final void onError(Throwable th) { if (this.c) { C13418fZu.c(th); return; } this.c = true; this.a.clear(); this.d.onError(th); } @Override // o.fTA, o.InterfaceC13174fSv public final void onComplete() { if (this.c) { return; } this.c = true; this.a.clear(); this.d.onComplete(); } @Override // o.InterfaceC13413fZp public final int b(int i) { return e(i); } @Override // o.InterfaceC13414fZq public final T b() throws Throwable { T b; do { b = this.e.b(); if (b == null) { break; } } while (!this.a.add((Object) Objects.requireNonNull(this.i.a(b), "The keySelector returned a null key"))); return b; } @Override // o.fTA, o.InterfaceC13414fZq public final void e() { this.a.clear(); super.e(); } } }