package nn;

import java.lang.reflect.Constructor;
import java.lang.reflect.GenericDeclaration;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import nn.j0;
import nn.k;
import nn.l;
import on.a;
import on.f;
import on.j;

/* loaded from: classes3.dex */
public final class s extends n implements kotlin.jvm.internal.o, kn.g, k {
    static final /* synthetic */ kn.l[] B = {kotlin.jvm.internal.p0.h(new kotlin.jvm.internal.g0(kotlin.jvm.internal.p0.b(s.class), "descriptor", "getDescriptor()Lorg/jetbrains/kotlin/descriptors/FunctionDescriptor;"))};
    private final rm.o A;

    /* renamed from: v, reason: collision with root package name */
    private final r f30305v;

    /* renamed from: w, reason: collision with root package name */
    private final String f30306w;

    /* renamed from: x, reason: collision with root package name */
    private final Object f30307x;

    /* renamed from: y, reason: collision with root package name */
    private final j0.a f30308y;

    /* renamed from: z, reason: collision with root package name */
    private final rm.o f30309z;

    /* loaded from: classes3.dex */
    static final class a extends kotlin.jvm.internal.v implements dn.a {
        a() {
            super(0);
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final on.e invoke() {
            int v10;
            Object b10;
            on.e M;
            int v11;
            l g10 = m0.f30218a.g(s.this.G());
            if (g10 instanceof l.d) {
                if (s.this.E()) {
                    Class e10 = s.this.A().e();
                    List parameters = s.this.getParameters();
                    v11 = sm.v.v(parameters, 10);
                    ArrayList arrayList = new ArrayList(v11);
                    Iterator it = parameters.iterator();
                    while (it.hasNext()) {
                        String name = ((kn.k) it.next()).getName();
                        kotlin.jvm.internal.t.d(name);
                        arrayList.add(name);
                    }
                    return new on.a(e10, arrayList, a.EnumC0724a.POSITIONAL_CALL, a.b.KOTLIN, null, 16, null);
                }
                b10 = s.this.A().r(((l.d) g10).b());
            } else if (g10 instanceof l.e) {
                tn.y G = s.this.G();
                tn.m b11 = G.b();
                kotlin.jvm.internal.t.f(b11, "getContainingDeclaration(...)");
                if (to.h.d(b11) && (G instanceof tn.l) && ((tn.l) G).w()) {
                    tn.y G2 = s.this.G();
                    r A = s.this.A();
                    String b12 = ((l.e) g10).b();
                    List i10 = s.this.G().i();
                    kotlin.jvm.internal.t.f(i10, "getValueParameters(...)");
                    return new j.b(G2, A, b12, i10);
                }
                l.e eVar = (l.e) g10;
                b10 = s.this.A().v(eVar.c(), eVar.b());
            } else if (g10 instanceof l.c) {
                b10 = ((l.c) g10).b();
            } else {
                if (!(g10 instanceof l.b)) {
                    if (!(g10 instanceof l.a)) {
                        throw new rm.t();
                    }
                    List b13 = ((l.a) g10).b();
                    Class e11 = s.this.A().e();
                    List list = b13;
                    v10 = sm.v.v(list, 10);
                    ArrayList arrayList2 = new ArrayList(v10);
                    Iterator it2 = list.iterator();
                    while (it2.hasNext()) {
                        arrayList2.add(((Method) it2.next()).getName());
                    }
                    return new on.a(e11, arrayList2, a.EnumC0724a.POSITIONAL_CALL, a.b.JAVA, b13);
                }
                b10 = ((l.b) g10).b();
            }
            if (b10 instanceof Constructor) {
                s sVar = s.this;
                M = sVar.L((Constructor) b10, sVar.G(), false);
            } else {
                if (!(b10 instanceof Method)) {
                    throw new h0("Could not compute caller for function: " + s.this.G() + " (member = " + b10 + ')');
                }
                Method method = (Method) b10;
                M = !Modifier.isStatic(method.getModifiers()) ? s.this.M(method) : s.this.G().getAnnotations().j(p0.j()) != null ? s.this.N(method) : s.this.O(method);
            }
            return on.k.i(M, s.this.G(), false, 2, null);
        }
    }

    /* loaded from: classes3.dex */
    static final class b extends kotlin.jvm.internal.v implements dn.a {
        b() {
            super(0);
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final on.e invoke() {
            GenericDeclaration genericDeclaration;
            int v10;
            int v11;
            on.e eVar;
            l g10 = m0.f30218a.g(s.this.G());
            if (g10 instanceof l.e) {
                tn.y G = s.this.G();
                tn.m b10 = G.b();
                kotlin.jvm.internal.t.f(b10, "getContainingDeclaration(...)");
                if (to.h.d(b10) && (G instanceof tn.l) && ((tn.l) G).w()) {
                    throw new h0(s.this.G().b() + " cannot have default arguments");
                }
                r A = s.this.A();
                l.e eVar2 = (l.e) g10;
                String c10 = eVar2.c();
                String b11 = eVar2.b();
                kotlin.jvm.internal.t.d(s.this.z().getMember());
                genericDeclaration = A.t(c10, b11, !Modifier.isStatic(r5.getModifiers()));
            } else if (g10 instanceof l.d) {
                if (s.this.E()) {
                    Class e10 = s.this.A().e();
                    List parameters = s.this.getParameters();
                    v11 = sm.v.v(parameters, 10);
                    ArrayList arrayList = new ArrayList(v11);
                    Iterator it = parameters.iterator();
                    while (it.hasNext()) {
                        String name = ((kn.k) it.next()).getName();
                        kotlin.jvm.internal.t.d(name);
                        arrayList.add(name);
                    }
                    return new on.a(e10, arrayList, a.EnumC0724a.CALL_BY_NAME, a.b.KOTLIN, null, 16, null);
                }
                genericDeclaration = s.this.A().s(((l.d) g10).b());
            } else {
                if (g10 instanceof l.a) {
                    List b12 = ((l.a) g10).b();
                    Class e11 = s.this.A().e();
                    List list = b12;
                    v10 = sm.v.v(list, 10);
                    ArrayList arrayList2 = new ArrayList(v10);
                    Iterator it2 = list.iterator();
                    while (it2.hasNext()) {
                        arrayList2.add(((Method) it2.next()).getName());
                    }
                    return new on.a(e11, arrayList2, a.EnumC0724a.CALL_BY_NAME, a.b.JAVA, b12);
                }
                genericDeclaration = null;
            }
            if (genericDeclaration instanceof Constructor) {
                s sVar = s.this;
                eVar = sVar.L((Constructor) genericDeclaration, sVar.G(), true);
            } else if (genericDeclaration instanceof Method) {
                if (s.this.G().getAnnotations().j(p0.j()) != null) {
                    tn.m b13 = s.this.G().b();
                    kotlin.jvm.internal.t.e(b13, "null cannot be cast to non-null type org.jetbrains.kotlin.descriptors.ClassDescriptor");
                    if (!((tn.e) b13).v()) {
                        eVar = s.this.N((Method) genericDeclaration);
                    }
                }
                eVar = s.this.O((Method) genericDeclaration);
            } else {
                eVar = null;
            }
            if (eVar != null) {
                return on.k.h(eVar, s.this.G(), true);
            }
            return null;
        }
    }

    /* loaded from: classes3.dex */
    static final class c extends kotlin.jvm.internal.v implements dn.a {

        /* renamed from: q, reason: collision with root package name */
        final /* synthetic */ String f30313q;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        c(String str) {
            super(0);
            this.f30313q = str;
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final tn.y invoke() {
            return s.this.A().u(this.f30313q, s.this.f30306w);
        }
    }

    /* synthetic */ s(r rVar, String str, String str2, tn.y yVar, Object obj, int i10, kotlin.jvm.internal.k kVar) {
        this(rVar, str, str2, yVar, (i10 & 16) != 0 ? kotlin.jvm.internal.f.NO_RECEIVER : obj);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final on.f L(Constructor constructor, tn.y yVar, boolean z10) {
        return (z10 || !yo.b.f(yVar)) ? F() ? new f.c(constructor, P()) : new f.e(constructor) : F() ? new f.a(constructor, P()) : new f.b(constructor);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final f.h M(Method method) {
        return F() ? new f.h.a(method, P()) : new f.h.e(method);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final f.h N(Method method) {
        return F() ? new f.h.b(method) : new f.h.C0726f(method);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final f.h O(Method method) {
        return F() ? new f.h.c(method, P()) : new f.h.g(method);
    }

    private final Object P() {
        return on.k.g(this.f30307x, G());
    }

    @Override // nn.n
    public r A() {
        return this.f30305v;
    }

    @Override // nn.n
    public on.e B() {
        return (on.e) this.A.getValue();
    }

    @Override // nn.n
    public boolean F() {
        return !kotlin.jvm.internal.t.b(this.f30307x, kotlin.jvm.internal.f.NO_RECEIVER);
    }

    @Override // nn.n
    /* renamed from: Q, reason: merged with bridge method [inline-methods] */
    public tn.y G() {
        Object b10 = this.f30308y.b(this, B[0]);
        kotlin.jvm.internal.t.f(b10, "getValue(...)");
        return (tn.y) b10;
    }

    public boolean equals(Object obj) {
        s c10 = p0.c(obj);
        return c10 != null && kotlin.jvm.internal.t.b(A(), c10.A()) && kotlin.jvm.internal.t.b(getName(), c10.getName()) && kotlin.jvm.internal.t.b(this.f30306w, c10.f30306w) && kotlin.jvm.internal.t.b(this.f30307x, c10.f30307x);
    }

    @Override // kotlin.jvm.internal.o
    public int getArity() {
        return on.g.a(z());
    }

    @Override // kn.c
    public String getName() {
        String e10 = G().getName().e();
        kotlin.jvm.internal.t.f(e10, "asString(...)");
        return e10;
    }

    public int hashCode() {
        return (((A().hashCode() * 31) + getName().hashCode()) * 31) + this.f30306w.hashCode();
    }

    @Override // dn.a
    public Object invoke() {
        return k.a.a(this);
    }

    @Override // kn.g
    public boolean isExternal() {
        return G().isExternal();
    }

    @Override // kn.g
    public boolean isInfix() {
        return G().isInfix();
    }

    @Override // kn.g
    public boolean isInline() {
        return G().isInline();
    }

    @Override // kn.g
    public boolean isOperator() {
        return G().isOperator();
    }

    @Override // kn.c
    public boolean isSuspend() {
        return G().isSuspend();
    }

    @Override // dn.r
    public Object j(Object obj, Object obj2, Object obj3, Object obj4) {
        return k.a.e(this, obj, obj2, obj3, obj4);
    }

    public String toString() {
        return l0.f30202a.d(G());
    }

    @Override // nn.n
    public on.e z() {
        return (on.e) this.f30309z.getValue();
    }

    @Override // dn.l
    public Object invoke(Object obj) {
        return k.a.b(this, obj);
    }

    private s(r rVar, String str, String str2, tn.y yVar, Object obj) {
        rm.o b10;
        rm.o b11;
        this.f30305v = rVar;
        this.f30306w = str2;
        this.f30307x = obj;
        this.f30308y = j0.c(yVar, new c(str));
        rm.s sVar = rm.s.PUBLICATION;
        b10 = rm.q.b(sVar, new a());
        this.f30309z = b10;
        b11 = rm.q.b(sVar, new b());
        this.A = b11;
    }

    @Override // dn.p
    public Object invoke(Object obj, Object obj2) {
        return k.a.c(this, obj, obj2);
    }

    @Override // dn.q
    public Object invoke(Object obj, Object obj2, Object obj3) {
        return k.a.d(this, obj, obj2, obj3);
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public s(r container, String name, String signature, Object obj) {
        this(container, name, signature, null, obj);
        kotlin.jvm.internal.t.g(container, "container");
        kotlin.jvm.internal.t.g(name, "name");
        kotlin.jvm.internal.t.g(signature, "signature");
    }

    /* JADX WARN: Illegal instructions before constructor call */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public s(r container, tn.y descriptor) {
        this(container, r3, m0.f30218a.g(descriptor).a(), descriptor, null, 16, null);
        kotlin.jvm.internal.t.g(container, "container");
        kotlin.jvm.internal.t.g(descriptor, "descriptor");
        String e10 = descriptor.getName().e();
        kotlin.jvm.internal.t.f(e10, "asString(...)");
    }
}
