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

247 lines
8.4 KiB
Java

package o;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
/* renamed from: o.fUS, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C13219fUS<T, R> extends AbstractC13163fSk<R> {
private AbstractC13163fSk<T> a;
private fSS<? super T, ? extends InterfaceC13160fSh<? extends R>> c;
private boolean d;
public C13219fUS(AbstractC13163fSk<T> abstractC13163fSk, fSS<? super T, ? extends InterfaceC13160fSh<? extends R>> fss, boolean z) {
this.a = abstractC13163fSk;
this.c = fss;
this.d = z;
}
@Override // o.AbstractC13163fSk
public final void subscribeActual(InterfaceC13174fSv<? super R> interfaceC13174fSv) {
if (fUP.e(this.a, this.c, interfaceC13174fSv)) {
return;
}
this.a.subscribe(new HBt(interfaceC13174fSv, this.c, this.d));
}
/* renamed from: o.fUS$HBt */
/* loaded from: classes6.dex */
static final class HBt<T, R> extends AtomicInteger implements InterfaceC13174fSv<T>, fSJ {
private static IeS<Object> b = new IeS<>(null);
final boolean a;
final C13355fYI c = new C13355fYI();
final AtomicReference<IeS<R>> d = new AtomicReference<>();
fSJ e;
private volatile boolean g;
private InterfaceC13174fSv<? super R> h;
private fSS<? super T, ? extends InterfaceC13160fSh<? extends R>> i;
private volatile boolean j;
HBt(InterfaceC13174fSv<? super R> interfaceC13174fSv, fSS<? super T, ? extends InterfaceC13160fSh<? extends R>> fss, boolean z) {
this.h = interfaceC13174fSv;
this.i = fss;
this.a = z;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
if (EnumC13192fTf.d(this.e, fsj)) {
this.e = fsj;
this.h.onSubscribe(this);
}
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
IeS<R> ieS = this.d.get();
if (ieS != null) {
EnumC13192fTf.e(ieS);
}
try {
InterfaceC13160fSh interfaceC13160fSh = (InterfaceC13160fSh) Objects.requireNonNull(this.i.a(t), "The mapper returned a null MaybeSource");
IeS<R> ieS2 = new IeS<>(this);
while (true) {
IeS<R> ieS3 = this.d.get();
if (ieS3 != b) {
AtomicReference<IeS<R>> atomicReference = this.d;
while (!atomicReference.compareAndSet(ieS3, ieS2)) {
if (atomicReference.get() != ieS3) {
break;
}
}
interfaceC13160fSh.c(ieS2);
return;
}
return;
}
} catch (Throwable th) {
C13147fSI.c(th);
this.e.dispose();
this.d.getAndSet(b);
onError(th);
}
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
this.g = true;
b();
}
final void a() {
AtomicReference<IeS<R>> atomicReference = this.d;
IeS<Object> ieS = b;
IeS<Object> ieS2 = (IeS) atomicReference.getAndSet(ieS);
if (ieS2 == null || ieS2 == ieS) {
return;
}
EnumC13192fTf.e(ieS2);
}
@Override // o.fSJ
public final void dispose() {
this.j = true;
this.e.dispose();
AtomicReference<IeS<R>> atomicReference = this.d;
IeS<Object> ieS = b;
IeS<Object> ieS2 = (IeS) atomicReference.getAndSet(ieS);
if (ieS2 != null && ieS2 != ieS) {
EnumC13192fTf.e(ieS2);
}
Throwable b2 = fYR.b(this.c);
if (b2 == null || b2 == fYR.b) {
return;
}
C13418fZu.c(b2);
}
final void b() {
if (getAndIncrement() != 0) {
return;
}
InterfaceC13174fSv<? super R> interfaceC13174fSv = this.h;
C13355fYI c13355fYI = this.c;
AtomicReference<IeS<R>> atomicReference = this.d;
int i = 1;
while (!this.j) {
if (c13355fYI.get() == null || this.a) {
boolean z = this.g;
IeS<R> ieS = atomicReference.get();
boolean z2 = ieS == null;
if (!z || !z2) {
if (z2 || ieS.b == null) {
i = addAndGet(-i);
if (i == 0) {
return;
}
} else {
while (!atomicReference.compareAndSet(ieS, null) && atomicReference.get() == ieS) {
}
interfaceC13174fSv.onNext(ieS.b);
}
} else {
Throwable b2 = fYR.b(c13355fYI);
if (b2 == null) {
interfaceC13174fSv.onComplete();
return;
} else {
if (b2 != fYR.b) {
interfaceC13174fSv.onError(b2);
return;
}
return;
}
}
} else {
Throwable b3 = fYR.b(c13355fYI);
if (b3 == null) {
interfaceC13174fSv.onComplete();
return;
} else {
if (b3 != fYR.b) {
interfaceC13174fSv.onError(b3);
return;
}
return;
}
}
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: o.fUS$HBt$IeS */
/* loaded from: classes6.dex */
public static final class IeS<R> extends AtomicReference<fSJ> implements InterfaceC13161fSi<R> {
private HBt<?, R> a;
volatile R b;
IeS(HBt<?, R> hBt) {
this.a = hBt;
}
@Override // o.InterfaceC13161fSi
public final void onSubscribe(fSJ fsj) {
EnumC13192fTf.a(this, fsj);
}
@Override // o.InterfaceC13161fSi
public final void e(R r) {
this.b = r;
this.a.b();
}
@Override // o.InterfaceC13161fSi
public final void onError(Throwable th) {
HBt<?, R> hBt = this.a;
AtomicReference<IeS<R>> atomicReference = hBt.d;
while (!atomicReference.compareAndSet(this, null)) {
if (atomicReference.get() != this) {
C13418fZu.c(th);
return;
}
}
if (fYR.c(hBt.c, th)) {
if (!hBt.a) {
hBt.e.dispose();
hBt.a();
}
hBt.b();
return;
}
C13418fZu.c(th);
}
@Override // o.InterfaceC13161fSi
public final void onComplete() {
HBt<?, R> hBt = this.a;
AtomicReference<IeS<R>> atomicReference = hBt.d;
while (!atomicReference.compareAndSet(this, null)) {
if (atomicReference.get() != this) {
return;
}
}
hBt.b();
}
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
if (fYR.c(this.c, th)) {
if (!this.a) {
a();
}
this.g = true;
b();
return;
}
C13418fZu.c(th);
}
@Override // o.fSJ
public final boolean isDisposed() {
return this.j;
}
}
}