package kotlin.reflect.w.internal;

import g.h.a.i;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Objects;
import kotlin.Lazy;
import kotlin.LazyThreadSafetyMode;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Lambda;
import kotlin.jvm.internal.o;
import kotlin.reflect.KProperty0;
import kotlin.reflect.full.IllegalPropertyDelegateAccessException;
import kotlin.reflect.w.internal.KPropertyImpl;
import kotlin.reflect.w.internal.y0.d.p0;

/* JADX INFO: renamed from: r.i0.w.b.a0, reason: from Kotlin metadata */
/* JADX INFO: loaded from: classes.dex */
@Metadata(d1 = {"\u0000B\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\t\b\u0010\u0018\u0000*\u0006\b\u0000\u0010\u0001 \u00012\b\u0012\u0004\u0012\u0002H\u00010\u00022\b\u0012\u0004\u0012\u0002H\u00010\u0003:\u0001\u001cB\u0017\b\u0016\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007¢\u0006\u0002\u0010\bB)\b\u0016\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\t\u001a\u00020\n\u0012\u0006\u0010\u000b\u001a\u00020\n\u0012\b\u0010\f\u001a\u0004\u0018\u00010\r¢\u0006\u0002\u0010\u000eJ\r\u0010\u0018\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010\u0019J\n\u0010\u001a\u001a\u0004\u0018\u00010\rH\u0016J\u000e\u0010\u001b\u001a\u00028\u0000H\u0096\u0002¢\u0006\u0002\u0010\u0019R(\u0010\u000f\u001a\u001c\u0012\u0018\u0012\u0016\u0012\u0004\u0012\u00028\u0000 \u0012*\n\u0012\u0004\u0012\u00028\u0000\u0018\u00010\u00110\u00110\u0010X\u0088\u0004¢\u0006\u0002\n\u0000R\u0016\u0010\u0013\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\r0\u0014X\u0082\u0004¢\u0006\u0002\n\u0000R\u001a\u0010\u0015\u001a\b\u0012\u0004\u0012\u00028\u00000\u00118VX\u0096\u0004¢\u0006\u0006\u001a\u0004\b\u0016\u0010\u0017¨\u0006\u001d"}, d2 = {"Lkotlin/reflect/jvm/internal/KProperty0Impl;", "V", "Lkotlin/reflect/KProperty0;", "Lkotlin/reflect/jvm/internal/KPropertyImpl;", "container", "Lkotlin/reflect/jvm/internal/KDeclarationContainerImpl;", "descriptor", "Lkotlin/reflect/jvm/internal/impl/descriptors/PropertyDescriptor;", "(Lkotlin/reflect/jvm/internal/KDeclarationContainerImpl;Lorg/jetbrains/kotlin/descriptors/PropertyDescriptor;)V", "name", "", "signature", "boundReceiver", "", "(Lkotlin/reflect/jvm/internal/KDeclarationContainerImpl;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Object;)V", "_getter", "Lkotlin/reflect/jvm/internal/ReflectProperties$LazyVal;", "Lkotlin/reflect/jvm/internal/KProperty0Impl$Getter;", "kotlin.jvm.PlatformType", "delegateValue", "Lkotlin/Lazy;", "getter", "getGetter", "()Lkotlin/reflect/jvm/internal/KProperty0Impl$Getter;", "get", "()Ljava/lang/Object;", "getDelegate", "invoke", "Getter", "kotlin-reflection"}, k = 1, mv = {1, 7, 1}, xi = 48)
public class KProperty0Impl<V> extends KPropertyImpl<V> implements KProperty0<V> {

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public final o0<a<V>> f6243w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public final Lazy<Object> f6244x;

    /* JADX INFO: renamed from: r.i0.w.b.a0$a */
    @Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0006\u0018\u0000*\u0006\b\u0001\u0010\u0001 \u00012\b\u0012\u0004\u0012\u0002H\u00010\u00022\b\u0012\u0004\u0012\u0002H\u00010\u0003B\u0013\u0012\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00028\u00010\u0005¢\u0006\u0002\u0010\u0006J\u000e\u0010\t\u001a\u00028\u0001H\u0096\u0002¢\u0006\u0002\u0010\nR\u001a\u0010\u0004\u001a\b\u0012\u0004\u0012\u00028\u00010\u0005X\u0096\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0007\u0010\b¨\u0006\u000b"}, d2 = {"Lkotlin/reflect/jvm/internal/KProperty0Impl$Getter;", "R", "Lkotlin/reflect/jvm/internal/KPropertyImpl$Getter;", "Lkotlin/reflect/KProperty0$Getter;", "property", "Lkotlin/reflect/jvm/internal/KProperty0Impl;", "(Lkotlin/reflect/jvm/internal/KProperty0Impl;)V", "getProperty", "()Lkotlin/reflect/jvm/internal/KProperty0Impl;", "invoke", "()Ljava/lang/Object;", "kotlin-reflection"}, k = 1, mv = {1, 7, 1}, xi = 48)
    public static final class a<R> extends KPropertyImpl.b<R> implements KProperty0.a<R> {

        /* JADX INFO: renamed from: s, reason: collision with root package name */
        public final KProperty0Impl<R> f6245s;

        /* JADX WARN: Multi-variable type inference failed */
        public a(KProperty0Impl<? extends R> kProperty0Impl) {
            o.f(kProperty0Impl, "property");
            this.f6245s = kProperty0Impl;
        }

        @Override // kotlin.jvm.functions.Function0
        public R invoke() {
            return this.f6245s.v();
        }

        @Override // kotlin.reflect.w.internal.KPropertyImpl.a
        public KPropertyImpl s() {
            return this.f6245s;
        }
    }

    /* JADX INFO: renamed from: r.i0.w.b.a0$b */
    @Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\u0010\u0000\u001a\u0016\u0012\u0004\u0012\u0002H\u0002 \u0003*\n\u0012\u0004\u0012\u0002H\u0002\u0018\u00010\u00010\u0001\"\u0006\b\u0000\u0010\u0002 \u0001H\n¢\u0006\u0002\b\u0004"}, d2 = {"<anonymous>", "Lkotlin/reflect/jvm/internal/KProperty0Impl$Getter;", "V", "kotlin.jvm.PlatformType", "invoke"}, k = 3, mv = {1, 7, 1}, xi = 48)
    public static final class b extends Lambda implements Function0<a<? extends V>> {

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public final /* synthetic */ KProperty0Impl<V> f6246f;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        /* JADX WARN: Multi-variable type inference failed */
        public b(KProperty0Impl<? extends V> kProperty0Impl) {
            super(0);
            this.f6246f = kProperty0Impl;
        }

        @Override // kotlin.jvm.functions.Function0
        public Object invoke() {
            return new a(this.f6246f);
        }
    }

    /* JADX INFO: renamed from: r.i0.w.b.a0$c */
    @Metadata(d1 = {"\u0000\n\n\u0000\n\u0002\u0010\u0000\n\u0002\b\u0002\u0010\u0000\u001a\u0004\u0018\u00010\u0001\"\u0006\b\u0000\u0010\u0002 \u0001H\n¢\u0006\u0002\b\u0003"}, d2 = {"<anonymous>", "", "V", "invoke"}, k = 3, mv = {1, 7, 1}, xi = 48)
    public static final class c extends Lambda implements Function0<Object> {

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public final /* synthetic */ KProperty0Impl<V> f6247f;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        /* JADX WARN: Multi-variable type inference failed */
        public c(KProperty0Impl<? extends V> kProperty0Impl) {
            super(0);
            this.f6247f = kProperty0Impl;
        }

        @Override // kotlin.jvm.functions.Function0
        public final Object invoke() throws IllegalPropertyDelegateAccessException {
            KProperty0Impl<V> kProperty0Impl = this.f6247f;
            Object objR = kProperty0Impl.r();
            Objects.requireNonNull(kProperty0Impl);
            try {
                Object obj = KPropertyImpl.f6280p;
                Object objF = kProperty0Impl.q() ? i.F(kProperty0Impl.f6284t, kProperty0Impl.o()) : null;
                if (!(objF != obj)) {
                    objF = null;
                }
                kProperty0Impl.q();
                AccessibleObject accessibleObject = objR instanceof AccessibleObject ? (AccessibleObject) objR : null;
                if (accessibleObject != null) {
                    accessibleObject.setAccessible(i.e2(kProperty0Impl));
                }
                if (objR == null) {
                    return null;
                }
                if (objR instanceof Field) {
                    return ((Field) objR).get(objF);
                }
                if (!(objR instanceof Method)) {
                    throw new AssertionError("delegate field/method " + objR + " neither field nor method");
                }
                int length = ((Method) objR).getParameterTypes().length;
                if (length == 0) {
                    return ((Method) objR).invoke(null, new Object[0]);
                }
                if (length == 1) {
                    Method method = (Method) objR;
                    Object[] objArr = new Object[1];
                    if (objF == null) {
                        Class<?> cls = ((Method) objR).getParameterTypes()[0];
                        o.e(cls, "fieldOrMethod.parameterTypes[0]");
                        objF = v0.e(cls);
                    }
                    objArr[0] = objF;
                    return method.invoke(null, objArr);
                }
                if (length == 2) {
                    Method method2 = (Method) objR;
                    Class<?> cls2 = ((Method) objR).getParameterTypes()[1];
                    o.e(cls2, "fieldOrMethod.parameterTypes[1]");
                    return method2.invoke(null, objF, v0.e(cls2));
                }
                throw new AssertionError("delegate method " + objR + " should take 0, 1, or 2 parameters");
            } catch (IllegalAccessException e2) {
                throw new IllegalPropertyDelegateAccessException(e2);
            }
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public KProperty0Impl(KDeclarationContainerImpl kDeclarationContainerImpl, String str, String str2, Object obj) {
        super(kDeclarationContainerImpl, str, str2, obj);
        o.f(kDeclarationContainerImpl, "container");
        o.f(str, "name");
        o.f(str2, "signature");
        o0<a<V>> o0VarE2 = i.E2(new b(this));
        o.e(o0VarE2, "lazy { Getter(this) }");
        this.f6243w = o0VarE2;
        this.f6244x = i.C2(LazyThreadSafetyMode.PUBLICATION, new c(this));
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public KProperty0Impl(KDeclarationContainerImpl kDeclarationContainerImpl, p0 p0Var) {
        super(kDeclarationContainerImpl, p0Var);
        o.f(kDeclarationContainerImpl, "container");
        o.f(p0Var, "descriptor");
        o0<a<V>> o0VarE2 = i.E2(new b(this));
        o.e(o0VarE2, "lazy { Getter(this) }");
        this.f6243w = o0VarE2;
        this.f6244x = i.C2(LazyThreadSafetyMode.PUBLICATION, new c(this));
    }

    @Override // kotlin.jvm.functions.Function0
    public V invoke() {
        return v();
    }

    public V v() {
        return t().call(new Object[0]);
    }

    @Override // kotlin.reflect.w.internal.KPropertyImpl
    /* JADX INFO: renamed from: w, reason: merged with bridge method [inline-methods] */
    public a<V> t() {
        a<V> aVarInvoke = this.f6243w.invoke();
        o.e(aVarInvoke, "_getter()");
        return aVarInvoke;
    }
}
