what-the-bank/sources/o/fUI.java

205 lines
7.8 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference;
/* loaded from: classes6.dex */
public final class fUI<T, R> extends AbstractC13163fSk<R> {
private AbstractC13163fSk<T> b;
private EnumC13357fYN c;
private int d;
private fSS<? super T, ? extends InterfaceC13160fSh<? extends R>> e;
public fUI(AbstractC13163fSk<T> abstractC13163fSk, fSS<? super T, ? extends InterfaceC13160fSh<? extends R>> fss, EnumC13357fYN enumC13357fYN, int i) {
this.b = abstractC13163fSk;
this.e = fss;
this.c = enumC13357fYN;
this.d = i;
}
@Override // o.AbstractC13163fSk
public final void subscribeActual(InterfaceC13174fSv<? super R> interfaceC13174fSv) {
if (fUP.e(this.b, this.e, interfaceC13174fSv)) {
return;
}
this.b.subscribe(new RVV(interfaceC13174fSv, this.e, this.d, this.c));
}
/* loaded from: classes6.dex */
static final class RVV<T, R> extends fUJ<T> {
volatile int g;
private InterfaceC13174fSv<? super R> h;
R i;
private HBt<R> j;
private fSS<? super T, ? extends InterfaceC13160fSh<? extends R>> m;
RVV(InterfaceC13174fSv<? super R> interfaceC13174fSv, fSS<? super T, ? extends InterfaceC13160fSh<? extends R>> fss, int i, EnumC13357fYN enumC13357fYN) {
super(i, enumC13357fYN);
this.h = interfaceC13174fSv;
this.m = fss;
this.j = new HBt<>(this);
}
@Override // o.fUJ
final void c() {
this.h.onSubscribe(this);
}
@Override // o.fUJ
final void e() {
if (getAndIncrement() != 0) {
return;
}
InterfaceC13174fSv<? super R> interfaceC13174fSv = this.h;
EnumC13357fYN enumC13357fYN = this.e;
InterfaceC13414fZq<T> interfaceC13414fZq = this.d;
C13355fYI c13355fYI = this.b;
int i = 1;
while (true) {
if (this.c) {
interfaceC13414fZq.e();
this.i = null;
} else {
int i2 = this.g;
if (c13355fYI.get() == null || (enumC13357fYN != EnumC13357fYN.IMMEDIATE && (enumC13357fYN != EnumC13357fYN.BOUNDARY || i2 != 0))) {
if (i2 == 0) {
boolean z = this.a;
try {
T b = interfaceC13414fZq.b();
boolean z2 = b == null;
if (z && z2) {
Throwable b2 = fYR.b(c13355fYI);
if (b2 == null) {
interfaceC13174fSv.onComplete();
return;
} else {
if (b2 != fYR.b) {
interfaceC13174fSv.onError(b2);
return;
}
return;
}
}
if (!z2) {
try {
InterfaceC13160fSh interfaceC13160fSh = (InterfaceC13160fSh) Objects.requireNonNull(this.m.a(b), "The mapper returned a null MaybeSource");
this.g = 1;
interfaceC13160fSh.c(this.j);
} catch (Throwable th) {
C13147fSI.c(th);
this.f.dispose();
interfaceC13414fZq.e();
if (!fYR.c(c13355fYI, th)) {
C13418fZu.c(th);
}
Throwable b3 = fYR.b(c13355fYI);
if (b3 == null) {
interfaceC13174fSv.onComplete();
return;
} else {
if (b3 != fYR.b) {
interfaceC13174fSv.onError(b3);
return;
}
return;
}
}
}
} catch (Throwable th2) {
C13147fSI.c(th2);
this.c = true;
this.f.dispose();
if (!fYR.c(c13355fYI, th2)) {
C13418fZu.c(th2);
}
Throwable b4 = fYR.b(c13355fYI);
if (b4 == null) {
interfaceC13174fSv.onComplete();
return;
} else {
if (b4 != fYR.b) {
interfaceC13174fSv.onError(b4);
return;
}
return;
}
}
} else if (i2 == 2) {
R r = this.i;
this.i = null;
interfaceC13174fSv.onNext(r);
this.g = 0;
}
}
}
i = addAndGet(-i);
if (i == 0) {
return;
}
}
interfaceC13414fZq.e();
this.i = null;
Throwable b5 = fYR.b(c13355fYI);
if (b5 == null) {
interfaceC13174fSv.onComplete();
} else if (b5 != fYR.b) {
interfaceC13174fSv.onError(b5);
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes6.dex */
public static final class HBt<R> extends AtomicReference<fSJ> implements InterfaceC13161fSi<R> {
private RVV<?, R> e;
HBt(RVV<?, R> rvv) {
this.e = rvv;
}
@Override // o.InterfaceC13161fSi
public final void onSubscribe(fSJ fsj) {
EnumC13192fTf.c(this, fsj);
}
@Override // o.InterfaceC13161fSi
public final void e(R r) {
RVV<?, R> rvv = this.e;
rvv.i = r;
rvv.g = 2;
rvv.e();
}
@Override // o.InterfaceC13161fSi
public final void onComplete() {
RVV<?, R> rvv = this.e;
rvv.g = 0;
rvv.e();
}
@Override // o.InterfaceC13161fSi
public final void onError(Throwable th) {
RVV<?, R> rvv = this.e;
if (fYR.c(rvv.b, th)) {
if (rvv.e != EnumC13357fYN.END) {
rvv.f.dispose();
}
rvv.g = 0;
rvv.e();
return;
}
C13418fZu.c(th);
}
}
@Override // o.fUJ
final void a() {
EnumC13192fTf.e(this.j);
}
@Override // o.fUJ
final void b() {
this.i = null;
}
}
}