You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

250 lines
8.0 KiB

package p060t1;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import kotlinx.coroutines.internal.C1360d;
import p006b1.C0472b;
import p006b1.C0484l;
import p012d1.InterfaceC0629d;
import p012d1.InterfaceC0633f;
import p018f1.InterfaceC0716d;
import p036l1.InterfaceC1432l;
import p039m1.C1470g;
/* renamed from: t1.i */
/* loaded from: classes.dex */
public class C1682i<T> extends AbstractC1674f0<T> implements InterfaceC1676g<T>, InterfaceC0716d {
/* renamed from: j */
public static final /* synthetic */ AtomicIntegerFieldUpdater f3907j = AtomicIntegerFieldUpdater.newUpdater(C1682i.class, "_decision");
/* renamed from: k */
public static final /* synthetic */ AtomicReferenceFieldUpdater f3908k = AtomicReferenceFieldUpdater.newUpdater(C1682i.class, Object.class, "_state");
private volatile /* synthetic */ int _decision;
private volatile /* synthetic */ Object _state;
/* renamed from: g */
public final InterfaceC0629d<T> f3909g;
/* renamed from: h */
public final InterfaceC0633f f3910h;
/* renamed from: i */
public InterfaceC1683i0 f3911i;
/* JADX WARN: Multi-variable type inference failed */
/* renamed from: u */
public static /* synthetic */ void m579u(C1682i c1682i, Object obj, int i, InterfaceC1432l interfaceC1432l, int i2, Object obj2) {
if (obj2 != null) {
throw new UnsupportedOperationException("Super calls with default arguments not supported in this target, function: resumeImpl");
}
if ((i2 & 4) != 0) {
interfaceC1432l = null;
}
c1682i.m580t(obj, i, interfaceC1432l);
}
@Override // p060t1.AbstractC1674f0
/* renamed from: a */
public void mo598a(Object obj, Throwable th) {
while (true) {
Object obj2 = this._state;
if (obj2 instanceof InterfaceC1678g1) {
throw new IllegalStateException("Not completed".toString());
}
if (obj2 instanceof C1703o) {
return;
}
if (obj2 instanceof C1699n) {
C1699n c1699n = (C1699n) obj2;
if (!(!c1699n.m531c())) {
throw new IllegalStateException("Must be called at most once".toString());
}
if (C1679h.m602a(f3908k, this, obj2, C1699n.m532b(c1699n, null, null, null, null, th, 15, null))) {
c1699n.m530d(this, th);
return;
}
} else if (C1679h.m602a(f3908k, this, obj2, new C1699n(obj2, null, null, null, th, 14, null))) {
return;
}
}
}
@Override // p060t1.AbstractC1674f0
/* renamed from: b */
public final InterfaceC0629d<T> mo597b() {
return this.f3909g;
}
@Override // p060t1.AbstractC1674f0
/* renamed from: c */
public Throwable mo596c(Object obj) {
Throwable mo596c = super.mo596c(obj);
if (mo596c == null) {
return null;
}
mo597b();
return mo596c;
}
@Override // p012d1.InterfaceC0629d
/* renamed from: d */
public InterfaceC0633f mo595d() {
return this.f3910h;
}
/* JADX WARN: Multi-variable type inference failed */
@Override // p060t1.AbstractC1674f0
/* renamed from: e */
public <T> T mo594e(Object obj) {
return obj instanceof C1699n ? (T) ((C1699n) obj).f3929a : obj;
}
@Override // p018f1.InterfaceC0716d
/* renamed from: f */
public InterfaceC0716d mo593f() {
InterfaceC0629d<T> interfaceC0629d = this.f3909g;
if (interfaceC0629d instanceof InterfaceC0716d) {
return (InterfaceC0716d) interfaceC0629d;
}
return null;
}
@Override // p060t1.AbstractC1674f0
/* renamed from: h */
public Object mo592h() {
return m584p();
}
@Override // p012d1.InterfaceC0629d
/* renamed from: i */
public void mo591i(Object obj) {
m579u(this, C1713s.m519c(obj, this), this.f3901f, null, 4, null);
}
/* renamed from: j */
public final Void m590j(Object obj) {
throw new IllegalStateException(C1470g.m1287j("Already resumed, but proposed with update ", obj).toString());
}
/* renamed from: k */
public final void m589k(AbstractC1670e abstractC1670e, Throwable th) {
try {
abstractC1670e.m609a(th);
} catch (Throwable th2) {
C1728x.m499a(mo595d(), new C1711r(C1470g.m1287j("Exception in invokeOnCancellation handler for ", this), th2));
}
}
/* renamed from: l */
public final void m588l(InterfaceC1432l<? super Throwable, C0484l> interfaceC1432l, Throwable th) {
try {
interfaceC1432l.mo510e(th);
} catch (Throwable th2) {
C1728x.m499a(mo595d(), new C1711r(C1470g.m1287j("Exception in resume onCancellation handler for ", this), th2));
}
}
/* renamed from: m */
public final void m587m() {
InterfaceC1683i0 interfaceC1683i0 = this.f3911i;
if (interfaceC1683i0 == null) {
return;
}
interfaceC1683i0.mo545b();
this.f3911i = C1675f1.f3902d;
}
/* renamed from: n */
public final void m586n() {
if (m582r()) {
return;
}
m587m();
}
/* renamed from: o */
public final void m585o(int i) {
if (m577w()) {
return;
}
C1677g0.m607a(this, i);
}
/* renamed from: p */
public final Object m584p() {
return this._state;
}
/* renamed from: q */
public final String m583q() {
Object m584p = m584p();
return m584p instanceof InterfaceC1678g1 ? "Active" : m584p instanceof C1685j ? "Cancelled" : "Completed";
}
/* renamed from: r */
public final boolean m582r() {
return C1677g0.m605c(this.f3901f) && ((C1360d) this.f3909g).m1548l();
}
/* renamed from: s */
public String m581s() {
return "CancellableContinuation";
}
/* renamed from: t */
public final void m580t(Object obj, int i, InterfaceC1432l<? super Throwable, C0484l> interfaceC1432l) {
Object obj2;
do {
obj2 = this._state;
if (!(obj2 instanceof InterfaceC1678g1)) {
if (obj2 instanceof C1685j) {
C1685j c1685j = (C1685j) obj2;
if (c1685j.m574c()) {
if (interfaceC1432l == null) {
return;
}
m588l(interfaceC1432l, c1685j.f3937a);
return;
}
}
m590j(obj);
throw new C0472b();
}
} while (!C1679h.m602a(f3908k, this, obj2, m578v((InterfaceC1678g1) obj2, obj, i, interfaceC1432l, null)));
m586n();
m585o(i);
}
public String toString() {
return m581s() + '(' + C1732z.m494c(this.f3909g) + "){" + m583q() + "}@" + C1732z.m495b(this);
}
/* renamed from: v */
public final Object m578v(InterfaceC1678g1 interfaceC1678g1, Object obj, int i, InterfaceC1432l<? super Throwable, C0484l> interfaceC1432l, Object obj2) {
if (obj instanceof C1703o) {
return obj;
}
if (C1677g0.m606b(i) || obj2 != null) {
if (interfaceC1432l == null && !(interfaceC1678g1 instanceof AbstractC1670e) && obj2 == null) {
return obj;
}
return new C1699n(obj, interfaceC1678g1 instanceof AbstractC1670e ? (AbstractC1670e) interfaceC1678g1 : null, interfaceC1432l, obj2, null, 16, null);
}
return obj;
}
/* renamed from: w */
public final boolean m577w() {
do {
int i = this._decision;
if (i != 0) {
if (i == 1) {
return false;
}
throw new IllegalStateException("Already resumed".toString());
}
} while (!f3907j.compareAndSet(this, 0, 2));
return true;
}
}