package p491;

import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.concurrent.CompletableFuture;
import javax.annotation.Nullable;
import org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement;
import p491.InterfaceC7311;
import retrofit2.HttpException;

/* JADX INFO: renamed from: ޓ.ބ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
@IgnoreJRERequirement
public final class C7314 extends InterfaceC7311.AbstractC7312 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static final InterfaceC7311.AbstractC7312 f21216 = new C7314();

    /* JADX INFO: renamed from: ޓ.ބ$֏, reason: contains not printable characters */
    @IgnoreJRERequirement
    public static final class C7315<R> implements InterfaceC7311<R, CompletableFuture<R>> {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final Type f21217;

        /* JADX INFO: renamed from: ޓ.ބ$֏$֏, reason: contains not printable characters */
        @IgnoreJRERequirement
        public class C7316 implements InterfaceC7313<R> {

            /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
            public final CompletableFuture<R> f21218;

            public C7316(C7315 c7315, CompletableFuture<R> completableFuture) {
                this.f21218 = completableFuture;
            }

            @Override // p491.InterfaceC7313
            /* JADX INFO: renamed from: ֏ */
            public void mo10957(InterfaceC7310<R> interfaceC7310, Throwable th) {
                this.f21218.completeExceptionally(th);
            }

            @Override // p491.InterfaceC7313
            /* JADX INFO: renamed from: ֏ */
            public void mo10958(InterfaceC7310<R> interfaceC7310, C7366<R> c7366) {
                if (c7366.m10977()) {
                    this.f21218.complete(c7366.f21357);
                } else {
                    this.f21218.completeExceptionally(new HttpException(c7366));
                }
            }
        }

        public C7315(Type type) {
            this.f21217 = type;
        }

        @Override // p491.InterfaceC7311
        /* JADX INFO: renamed from: ֏ */
        public Object mo10954(InterfaceC7310 interfaceC7310) {
            C7317 c7317 = new C7317(interfaceC7310);
            interfaceC7310.mo10950(new C7316(this, c7317));
            return c7317;
        }

        @Override // p491.InterfaceC7311
        /* JADX INFO: renamed from: ֏ */
        public Type mo10955() {
            return this.f21217;
        }
    }

    /* JADX INFO: renamed from: ޓ.ބ$ؠ, reason: contains not printable characters */
    @IgnoreJRERequirement
    public static final class C7317<T> extends CompletableFuture<T> {

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public final InterfaceC7310<?> f21219;

        public C7317(InterfaceC7310<?> interfaceC7310) {
            this.f21219 = interfaceC7310;
        }

        @Override // java.util.concurrent.CompletableFuture, java.util.concurrent.Future
        public boolean cancel(boolean z) {
            if (z) {
                this.f21219.cancel();
            }
            return super.cancel(z);
        }
    }

    /* JADX INFO: renamed from: ޓ.ބ$ހ, reason: contains not printable characters */
    @IgnoreJRERequirement
    public static final class C7318<R> implements InterfaceC7311<R, CompletableFuture<C7366<R>>> {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final Type f21220;

        /* JADX INFO: renamed from: ޓ.ބ$ހ$֏, reason: contains not printable characters */
        @IgnoreJRERequirement
        public class C7319 implements InterfaceC7313<R> {

            /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
            public final CompletableFuture<C7366<R>> f21221;

            public C7319(C7318 c7318, CompletableFuture<C7366<R>> completableFuture) {
                this.f21221 = completableFuture;
            }

            @Override // p491.InterfaceC7313
            /* JADX INFO: renamed from: ֏ */
            public void mo10957(InterfaceC7310<R> interfaceC7310, Throwable th) {
                this.f21221.completeExceptionally(th);
            }

            @Override // p491.InterfaceC7313
            /* JADX INFO: renamed from: ֏ */
            public void mo10958(InterfaceC7310<R> interfaceC7310, C7366<R> c7366) {
                this.f21221.complete(c7366);
            }
        }

        public C7318(Type type) {
            this.f21220 = type;
        }

        @Override // p491.InterfaceC7311
        /* JADX INFO: renamed from: ֏ */
        public Object mo10954(InterfaceC7310 interfaceC7310) {
            C7317 c7317 = new C7317(interfaceC7310);
            interfaceC7310.mo10950(new C7319(this, c7317));
            return c7317;
        }

        @Override // p491.InterfaceC7311
        /* JADX INFO: renamed from: ֏ */
        public Type mo10955() {
            return this.f21220;
        }
    }

    @Override // p491.InterfaceC7311.AbstractC7312
    @Nullable
    /* JADX INFO: renamed from: ֏ */
    public InterfaceC7311<?, ?> mo10956(Type type, Annotation[] annotationArr, C7367 c7367) {
        if (C7373.m10999(type) != CompletableFuture.class) {
            return null;
        }
        if (!(type instanceof ParameterizedType)) {
            throw new IllegalStateException("CompletableFuture return type must be parameterized as CompletableFuture<Foo> or CompletableFuture<? extends Foo>");
        }
        Type typeM10991 = C7373.m10991(0, (ParameterizedType) type);
        if (C7373.m10999(typeM10991) != C7366.class) {
            return new C7315(typeM10991);
        }
        if (typeM10991 instanceof ParameterizedType) {
            return new C7318(C7373.m10991(0, (ParameterizedType) typeM10991));
        }
        throw new IllegalStateException("Response must be parameterized as Response<Foo> or Response<? extends Foo>");
    }
}
