小红书.apk(点击下载) / q.java


package retrofit2;

import e23.b;
import e23.c;
import e23.d;
import e23.e;
import e23.f;
import e23.g;
import e23.h;
import e23.i;
import e23.j;
import e23.k;
import e23.l;
import e23.m;
import e23.n;
import e23.o;
import e23.p;
import e23.r;
import e23.s;
import e23.t;
import e23.u;
import e23.v;
import e23.x;
import e23.y;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.net.URI;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import kotlin.coroutines.Continuation;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.Request;
import retrofit2.n;

/* compiled from: RequestFactory */
public final class q {

    /* renamed from: a  reason: collision with root package name */
    public final Method f125950a;

    /* renamed from: b  reason: collision with root package name */
    public final HttpUrl f125951b;

    /* renamed from: c  reason: collision with root package name */
    public final String f125952c;

    /* renamed from: d  reason: collision with root package name */
    public final String f125953d;

    /* renamed from: e  reason: collision with root package name */
    public final Headers f125954e;

    /* renamed from: f  reason: collision with root package name */
    public final MediaType f125955f;

    /* renamed from: g  reason: collision with root package name */
    public final boolean f125956g;

    /* renamed from: h  reason: collision with root package name */
    public final boolean f125957h;

    /* renamed from: i  reason: collision with root package name */
    public final boolean f125958i;

    /* renamed from: j  reason: collision with root package name */
    public final n<?>[] f125959j;

    /* renamed from: k  reason: collision with root package name */
    public final boolean f125960k;

    /* compiled from: RequestFactory */
    public static final class a {

        /* renamed from: x  reason: collision with root package name */
        public static final Pattern f125961x = Pattern.compile("\\{([a-zA-Z][a-zA-Z0-9_-]*)\\}");

        /* renamed from: y  reason: collision with root package name */
        public static final Pattern f125962y = Pattern.compile("[a-zA-Z][a-zA-Z0-9_-]*");

        /* renamed from: a  reason: collision with root package name */
        public final s f125963a;

        /* renamed from: b  reason: collision with root package name */
        public final Method f125964b;

        /* renamed from: c  reason: collision with root package name */
        public final Annotation[] f125965c;

        /* renamed from: d  reason: collision with root package name */
        public final Annotation[][] f125966d;

        /* renamed from: e  reason: collision with root package name */
        public final Type[] f125967e;

        /* renamed from: f  reason: collision with root package name */
        public boolean f125968f;

        /* renamed from: g  reason: collision with root package name */
        public boolean f125969g;

        /* renamed from: h  reason: collision with root package name */
        public boolean f125970h;

        /* renamed from: i  reason: collision with root package name */
        public boolean f125971i;

        /* renamed from: j  reason: collision with root package name */
        public boolean f125972j;

        /* renamed from: k  reason: collision with root package name */
        public boolean f125973k;

        /* renamed from: l  reason: collision with root package name */
        public boolean f125974l;

        /* renamed from: m  reason: collision with root package name */
        public boolean f125975m;

        /* renamed from: n  reason: collision with root package name */
        public String f125976n;

        /* renamed from: o  reason: collision with root package name */
        public boolean f125977o;

        /* renamed from: p  reason: collision with root package name */
        public boolean f125978p;

        /* renamed from: q  reason: collision with root package name */
        public boolean f125979q;

        /* renamed from: r  reason: collision with root package name */
        public String f125980r;

        /* renamed from: s  reason: collision with root package name */
        public Headers f125981s;

        /* renamed from: t  reason: collision with root package name */
        public MediaType f125982t;

        /* renamed from: u  reason: collision with root package name */
        public Set<String> f125983u;

        /* renamed from: v  reason: collision with root package name */
        public n<?>[] f125984v;

        /* renamed from: w  reason: collision with root package name */
        public boolean f125985w;

        public a(s sVar, Method method) {
            this.f125963a = sVar;
            this.f125964b = method;
            this.f125965c = method.getAnnotations();
            this.f125967e = method.getGenericParameterTypes();
            this.f125966d = method.getParameterAnnotations();
        }

        public static Class<?> a(Class<?> cls) {
            if (Boolean.TYPE == cls) {
                return Boolean.class;
            }
            if (Byte.TYPE == cls) {
                return Byte.class;
            }
            if (Character.TYPE == cls) {
                return Character.class;
            }
            if (Double.TYPE == cls) {
                return Double.class;
            }
            if (Float.TYPE == cls) {
                return Float.class;
            }
            if (Integer.TYPE == cls) {
                return Integer.class;
            }
            if (Long.TYPE == cls) {
                return Long.class;
            }
            return Short.TYPE == cls ? Short.class : cls;
        }

        public static Set<String> h(String str) {
            Matcher matcher = f125961x.matcher(str);
            LinkedHashSet linkedHashSet = new LinkedHashSet();
            while (matcher.find()) {
                linkedHashSet.add(matcher.group(1));
            }
            return linkedHashSet;
        }

        public q b() {
            for (Annotation annotation : this.f125965c) {
                e(annotation);
            }
            if (this.f125976n != null) {
                if (!this.f125977o) {
                    if (this.f125979q) {
                        throw w.m(this.f125964b, "Multipart can only be specified on HTTP methods with request body (e.g., @POST).", new Object[0]);
                    } else if (this.f125978p) {
                        throw w.m(this.f125964b, "FormUrlEncoded can only be specified on HTTP methods with request body (e.g., @POST).", new Object[0]);
                    }
                }
                int length = this.f125966d.length;
                this.f125984v = new n[length];
                int i10 = length - 1;
                int i14 = 0;
                while (true) {
                    boolean z14 = true;
                    if (i14 >= length) {
                        break;
                    }
                    n<?>[] nVarArr = this.f125984v;
                    Type type = this.f125967e[i14];
                    Annotation[] annotationArr = this.f125966d[i14];
                    if (i14 != i10) {
                        z14 = false;
                    }
                    nVarArr[i14] = f(i14, type, annotationArr, z14);
                    i14++;
                }
                if (this.f125980r != null || this.f125975m) {
                    boolean z15 = this.f125978p;
                    if (!z15 && !this.f125979q && !this.f125977o && this.f125970h) {
                        throw w.m(this.f125964b, "Non-body HTTP method cannot contain @Body.", new Object[0]);
                    } else if (z15 && !this.f125968f) {
                        throw w.m(this.f125964b, "Form-encoded method must contain at least one @Field.", new Object[0]);
                    } else if (!this.f125979q || this.f125969g) {
                        return new q(this);
                    } else {
                        throw w.m(this.f125964b, "Multipart method must contain at least one @Part.", new Object[0]);
                    }
                } else {
                    throw w.m(this.f125964b, "Missing either @%s URL or @Url parameter.", this.f125976n);
                }
            } else {
                throw w.m(this.f125964b, "HTTP method annotation is required (e.g., @GET, @POST, etc.).", new Object[0]);
            }
        }

        public final Headers c(String[] strArr) {
            Headers.Builder builder = new Headers.Builder();
            for (String str : strArr) {
                int indexOf = str.indexOf(58);
                if (indexOf == -1 || indexOf == 0 || indexOf == str.length() - 1) {
                    throw w.m(this.f125964b, "@Headers value must be in the form \"Name: Value\". Found: \"%s\"", str);
                }
                String substring = str.substring(0, indexOf);
                String trim = str.substring(indexOf + 1).trim();
                if ("Content-Type".equalsIgnoreCase(substring)) {
                    try {
                        this.f125982t = MediaType.get(trim);
                    } catch (IllegalArgumentException e14) {
                        throw w.n(this.f125964b, e14, "Malformed content type: %s", trim);
                    }
                } else {
                    builder.add(substring, trim);
                }
            }
            return builder.build();
        }

        public final void d(String str, String str2, boolean z14) {
            String str3 = this.f125976n;
            if (str3 == null) {
                this.f125976n = str;
                this.f125977o = z14;
                if (!str2.isEmpty()) {
                    int indexOf = str2.indexOf(63);
                    if (indexOf != -1 && indexOf < str2.length() - 1) {
                        String substring = str2.substring(indexOf + 1);
                        if (f125961x.matcher(substring).find()) {
                            throw w.m(this.f125964b, "URL query string \"%s\" must not have replace block. For dynamic query parameters use @Query.", substring);
                        }
                    }
                    this.f125980r = str2;
                    this.f125983u = h(str2);
                    return;
                }
                return;
            }
            throw w.m(this.f125964b, "Only one HTTP method is allowed. Found: %s and %s.", str3, str);
        }

        public final void e(Annotation annotation) {
            if (annotation instanceof b) {
                d("DELETE", ((b) annotation).value(), false);
            } else if (annotation instanceof f) {
                d("GET", ((f) annotation).value(), false);
            } else if (annotation instanceof g) {
                d("HEAD", ((g) annotation).value(), false);
            } else if (annotation instanceof n) {
                d("PATCH", ((n) annotation).value(), true);
            } else if (annotation instanceof o) {
                d("POST", ((o) annotation).value(), true);
            } else if (annotation instanceof p) {
                d("PUT", ((p) annotation).value(), true);
            } else if (annotation instanceof m) {
                d("OPTIONS", ((m) annotation).value(), false);
            } else if (annotation instanceof h) {
                h hVar = (h) annotation;
                d(hVar.method(), hVar.path(), hVar.hasBody());
            } else if (annotation instanceof k) {
                String[] value = ((k) annotation).value();
                if (value.length != 0) {
                    this.f125981s = c(value);
                    return;
                }
                throw w.m(this.f125964b, "@Headers annotation is empty.", new Object[0]);
            } else if (annotation instanceof l) {
                if (!this.f125978p) {
                    this.f125979q = true;
                    return;
                }
                throw w.m(this.f125964b, "Only one encoding annotation is allowed.", new Object[0]);
            } else if (!(annotation instanceof e)) {
            } else {
                if (!this.f125979q) {
                    this.f125978p = true;
                    return;
                }
                throw w.m(this.f125964b, "Only one encoding annotation is allowed.", new Object[0]);
            }
        }

        public final n<?> f(int i10, Type type, Annotation[] annotationArr, boolean z14) {
            n<?> nVar;
            if (annotationArr != null) {
                nVar = null;
                for (Annotation annotation : annotationArr) {
                    n<?> g10 = g(i10, type, annotationArr, annotation);
                    if (g10 != null) {
                        if (nVar == null) {
                            nVar = g10;
                        } else {
                            throw w.o(this.f125964b, i10, "Multiple Retrofit annotations found, only one allowed.", new Object[0]);
                        }
                    }
                }
            } else {
                nVar = null;
            }
            if (nVar != null) {
                return nVar;
            }
            if (z14) {
                try {
                    if (w.h(type) == Continuation.class) {
                        this.f125985w = true;
                        return null;
                    }
                } catch (NoClassDefFoundError unused) {
                }
            }
            throw w.o(this.f125964b, i10, "No Retrofit annotation found.", new Object[0]);
        }

        public final n<?> g(int i10, Type type, Annotation[] annotationArr, Annotation annotation) {
            if (annotation instanceof y) {
                j(i10, type);
                if (this.f125975m) {
                    throw w.o(this.f125964b, i10, "Multiple @Url method annotations found.", new Object[0]);
                } else if (this.f125971i) {
                    throw w.o(this.f125964b, i10, "@Path parameters may not be used with @Url.", new Object[0]);
                } else if (this.f125972j) {
                    throw w.o(this.f125964b, i10, "A @Url parameter must not come after a @Query.", new Object[0]);
                } else if (this.f125973k) {
                    throw w.o(this.f125964b, i10, "A @Url parameter must not come after a @QueryName.", new Object[0]);
                } else if (this.f125974l) {
                    throw w.o(this.f125964b, i10, "A @Url parameter must not come after a @QueryMap.", new Object[0]);
                } else if (this.f125980r == null) {
                    this.f125975m = true;
                    if (type == HttpUrl.class || type == String.class || type == URI.class || ((type instanceof Class) && "android.net.Uri".equals(((Class) type).getName()))) {
                        return new n.p(this.f125964b, i10);
                    }
                    throw w.o(this.f125964b, i10, "@Url must be okhttp3.HttpUrl, String, java.net.URI, or android.net.Uri type.", new Object[0]);
                } else {
                    throw w.o(this.f125964b, i10, "@Url cannot be used with @%s URL", this.f125976n);
                }
            } else if (annotation instanceof s) {
                j(i10, type);
                if (this.f125972j) {
                    throw w.o(this.f125964b, i10, "A @Path parameter must not come after a @Query.", new Object[0]);
                } else if (this.f125973k) {
                    throw w.o(this.f125964b, i10, "A @Path parameter must not come after a @QueryName.", new Object[0]);
                } else if (this.f125974l) {
                    throw w.o(this.f125964b, i10, "A @Path parameter must not come after a @QueryMap.", new Object[0]);
                } else if (this.f125975m) {
                    throw w.o(this.f125964b, i10, "@Path parameters may not be used with @Url.", new Object[0]);
                } else if (this.f125980r != null) {
                    this.f125971i = true;
                    s sVar = (s) annotation;
                    String value = sVar.value();
                    i(i10, value);
                    return new n.k(this.f125964b, i10, value, this.f125963a.i(type, annotationArr), sVar.encoded());
                } else {
                    throw w.o(this.f125964b, i10, "@Path can only be used with relative url on @%s", this.f125976n);
                }
            } else if (annotation instanceof t) {
                j(i10, type);
                t tVar = (t) annotation;
                String value2 = tVar.value();
                boolean encoded = tVar.encoded();
                Class<?> h10 = w.h(type);
                this.f125972j = true;
                if (Iterable.class.isAssignableFrom(h10)) {
                    if (type instanceof ParameterizedType) {
                        return new n.l(value2, this.f125963a.i(w.g(0, (ParameterizedType) type), annotationArr), encoded).c();
                    }
                    throw w.o(this.f125964b, i10, h10.getSimpleName() + " must include generic type (e.g., " + h10.getSimpleName() + "<String>)", new Object[0]);
                } else if (!h10.isArray()) {
                    return new n.l(value2, this.f125963a.i(type, annotationArr), encoded);
                } else {
                    return new n.l(value2, this.f125963a.i(a(h10.getComponentType()), annotationArr), encoded).b();
                }
            } else if (annotation instanceof v) {
                j(i10, type);
                boolean encoded2 = ((v) annotation).encoded();
                Class<?> h14 = w.h(type);
                this.f125973k = true;
                if (Iterable.class.isAssignableFrom(h14)) {
                    if (type instanceof ParameterizedType) {
                        return new n.C1995n(this.f125963a.i(w.g(0, (ParameterizedType) type), annotationArr), encoded2).c();
                    }
                    throw w.o(this.f125964b, i10, h14.getSimpleName() + " must include generic type (e.g., " + h14.getSimpleName() + "<String>)", new Object[0]);
                } else if (!h14.isArray()) {
                    return new n.C1995n(this.f125963a.i(type, annotationArr), encoded2);
                } else {
                    return new n.C1995n(this.f125963a.i(a(h14.getComponentType()), annotationArr), encoded2).b();
                }
            } else if (annotation instanceof u) {
                j(i10, type);
                Class<?> h15 = w.h(type);
                this.f125974l = true;
                if (Map.class.isAssignableFrom(h15)) {
                    Type i14 = w.i(type, h15, Map.class);
                    if (i14 instanceof ParameterizedType) {
                        ParameterizedType parameterizedType = (ParameterizedType) i14;
                        Type g10 = w.g(0, parameterizedType);
                        if (String.class == g10) {
                            return new n.m(this.f125964b, i10, this.f125963a.i(w.g(1, parameterizedType), annotationArr), ((u) annotation).encoded());
                        }
                        throw w.o(this.f125964b, i10, "@QueryMap keys must be of type String: " + g10, new Object[0]);
                    }
                    throw w.o(this.f125964b, i10, "Map must include generic types (e.g., Map<String, String>)", new Object[0]);
                }
                throw w.o(this.f125964b, i10, "@QueryMap parameter type must be Map.", new Object[0]);
            } else if (annotation instanceof i) {
                j(i10, type);
                String value3 = ((i) annotation).value();
                Class<?> h16 = w.h(type);
                if (Iterable.class.isAssignableFrom(h16)) {
                    if (type instanceof ParameterizedType) {
                        return new n.f(value3, this.f125963a.i(w.g(0, (ParameterizedType) type), annotationArr)).c();
                    }
                    throw w.o(this.f125964b, i10, h16.getSimpleName() + " must include generic type (e.g., " + h16.getSimpleName() + "<String>)", new Object[0]);
                } else if (!h16.isArray()) {
                    return new n.f(value3, this.f125963a.i(type, annotationArr));
                } else {
                    return new n.f(value3, this.f125963a.i(a(h16.getComponentType()), annotationArr)).b();
                }
            } else if (annotation instanceof j) {
                if (type == Headers.class) {
                    return new n.h(this.f125964b, i10);
                }
                j(i10, type);
                Class<?> h17 = w.h(type);
                if (Map.class.isAssignableFrom(h17)) {
                    Type i15 = w.i(type, h17, Map.class);
                    if (i15 instanceof ParameterizedType) {
                        ParameterizedType parameterizedType2 = (ParameterizedType) i15;
                        Type g14 = w.g(0, parameterizedType2);
                        if (String.class == g14) {
                            return new n.g(this.f125964b, i10, this.f125963a.i(w.g(1, parameterizedType2), annotationArr));
                        }
                        throw w.o(this.f125964b, i10, "@HeaderMap keys must be of type String: " + g14, new Object[0]);
                    }
                    throw w.o(this.f125964b, i10, "Map must include generic types (e.g., Map<String, String>)", new Object[0]);
                }
                throw w.o(this.f125964b, i10, "@HeaderMap parameter type must be Map.", new Object[0]);
            } else if (annotation instanceof c) {
                j(i10, type);
                if (this.f125978p) {
                    c cVar = (c) annotation;
                    String value4 = cVar.value();
                    boolean encoded3 = cVar.encoded();
                    this.f125968f = true;
                    Class<?> h18 = w.h(type);
                    if (Iterable.class.isAssignableFrom(h18)) {
                        if (type instanceof ParameterizedType) {
                            return new n.d(value4, this.f125963a.i(w.g(0, (ParameterizedType) type), annotationArr), encoded3).c();
                        }
                        throw w.o(this.f125964b, i10, h18.getSimpleName() + " must include generic type (e.g., " + h18.getSimpleName() + "<String>)", new Object[0]);
                    } else if (!h18.isArray()) {
                        return new n.d(value4, this.f125963a.i(type, annotationArr), encoded3);
                    } else {
                        return new n.d(value4, this.f125963a.i(a(h18.getComponentType()), annotationArr), encoded3).b();
                    }
                } else {
                    throw w.o(this.f125964b, i10, "@Field parameters can only be used with form encoding.", new Object[0]);
                }
            } else if (annotation instanceof d) {
                j(i10, type);
                if (this.f125978p) {
                    Class<?> h19 = w.h(type);
                    if (Map.class.isAssignableFrom(h19)) {
                        Type i16 = w.i(type, h19, Map.class);
                        if (i16 instanceof ParameterizedType) {
                            ParameterizedType parameterizedType3 = (ParameterizedType) i16;
                            Type g15 = w.g(0, parameterizedType3);
                            if (String.class == g15) {
                                f i17 = this.f125963a.i(w.g(1, parameterizedType3), annotationArr);
                                this.f125968f = true;
                                return new n.e(this.f125964b, i10, i17, ((d) annotation).encoded());
                            }
                            throw w.o(this.f125964b, i10, "@FieldMap keys must be of type String: " + g15, new Object[0]);
                        }
                        throw w.o(this.f125964b, i10, "Map must include generic types (e.g., Map<String, String>)", new Object[0]);
                    }
                    throw w.o(this.f125964b, i10, "@FieldMap parameter type must be Map.", new Object[0]);
                }
                throw w.o(this.f125964b, i10, "@FieldMap parameters can only be used with form encoding.", new Object[0]);
            } else if (annotation instanceof e23.q) {
                j(i10, type);
                if (this.f125979q) {
                    e23.q qVar = (e23.q) annotation;
                    this.f125969g = true;
                    String value5 = qVar.value();
                    Class<?> h24 = w.h(type);
                    if (!value5.isEmpty()) {
                        Headers of3 = Headers.of("Content-Disposition", "form-data; name=\"" + value5 + "\"", "Content-Transfer-Encoding", qVar.encoding());
                        if (Iterable.class.isAssignableFrom(h24)) {
                            if (type instanceof ParameterizedType) {
                                Type g16 = w.g(0, (ParameterizedType) type);
                                if (!MultipartBody.Part.class.isAssignableFrom(w.h(g16))) {
                                    return new n.i(this.f125964b, i10, of3, this.f125963a.g(g16, annotationArr, this.f125965c)).c();
                                }
                                throw w.o(this.f125964b, i10, "@Part parameters using the MultipartBody.Part must not include a part name in the annotation.", new Object[0]);
                            }
                            throw w.o(this.f125964b, i10, h24.getSimpleName() + " must include generic type (e.g., " + h24.getSimpleName() + "<String>)", new Object[0]);
                        } else if (h24.isArray()) {
                            Class<?> a14 = a(h24.getComponentType());
                            if (!MultipartBody.Part.class.isAssignableFrom(a14)) {
                                return new n.i(this.f125964b, i10, of3, this.f125963a.g(a14, annotationArr, this.f125965c)).b();
                            }
                            throw w.o(this.f125964b, i10, "@Part parameters using the MultipartBody.Part must not include a part name in the annotation.", new Object[0]);
                        } else if (!MultipartBody.Part.class.isAssignableFrom(h24)) {
                            return new n.i(this.f125964b, i10, of3, this.f125963a.g(type, annotationArr, this.f125965c));
                        } else {
                            throw w.o(this.f125964b, i10, "@Part parameters using the MultipartBody.Part must not include a part name in the annotation.", new Object[0]);
                        }
                    } else if (Iterable.class.isAssignableFrom(h24)) {
                        if (!(type instanceof ParameterizedType)) {
                            throw w.o(this.f125964b, i10, h24.getSimpleName() + " must include generic type (e.g., " + h24.getSimpleName() + "<String>)", new Object[0]);
                        } else if (MultipartBody.Part.class.isAssignableFrom(w.h(w.g(0, (ParameterizedType) type)))) {
                            return n.o.f125927a.c();
                        } else {
                            throw w.o(this.f125964b, i10, "@Part annotation must supply a name or use MultipartBody.Part parameter type.", new Object[0]);
                        }
                    } else if (h24.isArray()) {
                        if (MultipartBody.Part.class.isAssignableFrom(h24.getComponentType())) {
                            return n.o.f125927a.b();
                        }
                        throw w.o(this.f125964b, i10, "@Part annotation must supply a name or use MultipartBody.Part parameter type.", new Object[0]);
                    } else if (MultipartBody.Part.class.isAssignableFrom(h24)) {
                        return n.o.f125927a;
                    } else {
                        throw w.o(this.f125964b, i10, "@Part annotation must supply a name or use MultipartBody.Part parameter type.", new Object[0]);
                    }
                } else {
                    throw w.o(this.f125964b, i10, "@Part parameters can only be used with multipart encoding.", new Object[0]);
                }
            } else if (annotation instanceof r) {
                j(i10, type);
                if (this.f125979q) {
                    this.f125969g = true;
                    Class<?> h25 = w.h(type);
                    if (Map.class.isAssignableFrom(h25)) {
                        Type i18 = w.i(type, h25, Map.class);
                        if (i18 instanceof ParameterizedType) {
                            ParameterizedType parameterizedType4 = (ParameterizedType) i18;
                            Type g17 = w.g(0, parameterizedType4);
                            if (String.class == g17) {
                                Type g18 = w.g(1, parameterizedType4);
                                if (!MultipartBody.Part.class.isAssignableFrom(w.h(g18))) {
                                    return new n.j(this.f125964b, i10, this.f125963a.g(g18, annotationArr, this.f125965c), ((r) annotation).encoding());
                                }
                                throw w.o(this.f125964b, i10, "@PartMap values cannot be MultipartBody.Part. Use @Part List<Part> or a different value type instead.", new Object[0]);
                            }
                            throw w.o(this.f125964b, i10, "@PartMap keys must be of type String: " + g17, new Object[0]);
                        }
                        throw w.o(this.f125964b, i10, "Map must include generic types (e.g., Map<String, String>)", new Object[0]);
                    }
                    throw w.o(this.f125964b, i10, "@PartMap parameter type must be Map.", new Object[0]);
                }
                throw w.o(this.f125964b, i10, "@PartMap parameters can only be used with multipart encoding.", new Object[0]);
            } else if (annotation instanceof e23.a) {
                j(i10, type);
                if (this.f125978p || this.f125979q) {
                    throw w.o(this.f125964b, i10, "@Body parameters cannot be used with form or multi-part encoding.", new Object[0]);
                } else if (!this.f125970h) {
                    try {
                        f g19 = this.f125963a.g(type, annotationArr, this.f125965c);
                        this.f125970h = true;
                        return new n.c(this.f125964b, i10, g19);
                    } catch (RuntimeException e14) {
                        throw w.p(this.f125964b, e14, i10, "Unable to create @Body converter for %s", type);
                    }
                } else {
                    throw w.o(this.f125964b, i10, "Multiple @Body method annotations found.", new Object[0]);
                }
            } else if (!(annotation instanceof x)) {
                return null;
            } else {
                j(i10, type);
                Class<?> h26 = w.h(type);
                for (int i19 = i10 - 1; i19 >= 0; i19--) {
                    n<?> nVar = this.f125984v[i19];
                    if ((nVar instanceof n.q) && ((n.q) nVar).f125930a.equals(h26)) {
                        throw w.o(this.f125964b, i10, "@Tag type " + h26.getName() + " is duplicate of parameter #" + (i19 + 1) + " and would always overwrite its value.", new Object[0]);
                    }
                }
                return new n.q(h26);
            }
        }

        public final void i(int i10, String str) {
            if (!f125962y.matcher(str).matches()) {
                throw w.o(this.f125964b, i10, "@Path parameter name must match %s. Found: %s", f125961x.pattern(), str);
            } else if (!this.f125983u.contains(str)) {
                throw w.o(this.f125964b, i10, "URL \"%s\" does not contain \"{%s}\".", this.f125980r, str);
            }
        }

        public final void j(int i10, Type type) {
            if (w.j(type)) {
                throw w.o(this.f125964b, i10, "Parameter type must not include a type variable or wildcard: %s", type);
            }
        }
    }

    public q(a aVar) {
        this.f125950a = aVar.f125964b;
        this.f125951b = aVar.f125963a.f125991c;
        this.f125952c = aVar.f125976n;
        this.f125953d = aVar.f125980r;
        this.f125954e = aVar.f125981s;
        this.f125955f = aVar.f125982t;
        this.f125956g = aVar.f125977o;
        this.f125957h = aVar.f125978p;
        this.f125958i = aVar.f125979q;
        this.f125959j = aVar.f125984v;
        this.f125960k = aVar.f125985w;
    }

    public static q b(s sVar, Method method) {
        return new a(sVar, method).b();
    }

    public Request a(Object[] objArr) throws IOException {
        n<?>[] nVarArr = this.f125959j;
        int length = objArr.length;
        if (length == nVarArr.length) {
            p pVar = new p(this.f125952c, this.f125951b, this.f125953d, this.f125954e, this.f125955f, this.f125956g, this.f125957h, this.f125958i);
            if (this.f125960k) {
                length--;
            }
            ArrayList arrayList = new ArrayList(length);
            for (int i10 = 0; i10 < length; i10++) {
                arrayList.add(objArr[i10]);
                nVarArr[i10].a(pVar, objArr[i10]);
            }
            return pVar.k().tag(k.class, new k(this.f125950a, arrayList)).build();
        }
        throw new IllegalArgumentException("Argument count (" + length + ") doesn't match expected count (" + nVarArr.length + ")");
    }
}