package ca.canadapost.module.customsform.enhancement;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.p0;
import androidx.lifecycle.c1;
import androidx.lifecycle.d1;
import androidx.lifecycle.e1;
import androidx.lifecycle.g0;
import dn.l;
import dn.p;
import ib.b1;
import ib.h0;
import ib.x0;
import kotlin.Metadata;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;
import mb.n;
import rm.i;
import rm.n0;
import rm.o;
import v4.j;
import y0.m;
import y0.q1;
import y0.s3;

@Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\b\b\u0007\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0013\u0010\u0014J$\u0010\t\u001a\u00020\b2\u0006\u0010\u0003\u001a\u00020\u00022\b\u0010\u0005\u001a\u0004\u0018\u00010\u00042\b\u0010\u0007\u001a\u0004\u0018\u00010\u0006H\u0016J\u001a\u0010\f\u001a\u00020\u000b2\u0006\u0010\n\u001a\u00020\b2\b\u0010\u0007\u001a\u0004\u0018\u00010\u0006H\u0016R\u001b\u0010\u0012\u001a\u00020\r8BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u000e\u0010\u000f\u001a\u0004\b\u0010\u0010\u0011¨\u0006\u0015"}, d2 = {"Lca/canadapost/module/customsform/enhancement/CustomsFormNewItemFragmentCompose;", "Lu8/b;", "Landroid/view/LayoutInflater;", "inflater", "Landroid/view/ViewGroup;", "container", "Landroid/os/Bundle;", "savedInstanceState", "Landroid/view/View;", "onCreateView", "view", "Lrm/n0;", "onViewCreated", "Lib/h0;", "s", "Lrm/o;", "I", "()Lib/h0;", "viewModel", "<init>", "()V", "customsform_productionRelease"}, k = 1, mv = {1, 9, 0})
/* loaded from: classes4.dex */
public final class CustomsFormNewItemFragmentCompose extends u8.b {

    /* renamed from: s, reason: collision with root package name and from kotlin metadata */
    private final o viewModel = p0.a(this, kotlin.jvm.internal.p0.b(h0.class), new f(new e(this)), new g());

    /* loaded from: classes4.dex */
    static final class a extends v implements p {

        /* JADX INFO: Access modifiers changed from: package-private */
        /* renamed from: ca.canadapost.module.customsform.enhancement.CustomsFormNewItemFragmentCompose$a$a, reason: collision with other inner class name */
        /* loaded from: classes4.dex */
        public static final class C0226a extends v implements dn.a {

            /* renamed from: p, reason: collision with root package name */
            final /* synthetic */ q1 f8453p;

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

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            C0226a(q1 q1Var, CustomsFormNewItemFragmentCompose customsFormNewItemFragmentCompose) {
                super(0);
                this.f8453p = q1Var;
                this.f8454q = customsFormNewItemFragmentCompose;
            }

            @Override // dn.a
            public /* bridge */ /* synthetic */ Object invoke() {
                m76invoke();
                return n0.f34904a;
            }

            /* renamed from: invoke, reason: collision with other method in class */
            public final void m76invoke() {
                this.f8453p.setValue(Boolean.FALSE);
                x4.d.a(this.f8454q).U();
            }
        }

        /* JADX INFO: Access modifiers changed from: package-private */
        /* loaded from: classes4.dex */
        public static final class b extends v implements p {

            /* renamed from: p, reason: collision with root package name */
            final /* synthetic */ CustomsFormNewItemFragmentCompose f8455p;

            /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
            b(CustomsFormNewItemFragmentCompose customsFormNewItemFragmentCompose) {
                super(2);
                this.f8455p = customsFormNewItemFragmentCompose;
            }

            public final void a(m mVar, int i10) {
                if ((i10 & 11) == 2 && mVar.v()) {
                    mVar.A();
                    return;
                }
                if (y0.p.H()) {
                    y0.p.Q(1298223126, i10, -1, "ca.canadapost.module.customsform.enhancement.CustomsFormNewItemFragmentCompose.onCreateView.<anonymous>.<anonymous> (CustomsFormNewItemFragmentCompose.kt:43)");
                }
                n.a(this.f8455p.I(), mVar, 8);
                if (y0.p.H()) {
                    y0.p.P();
                }
            }

            @Override // dn.p
            public /* bridge */ /* synthetic */ Object invoke(Object obj, Object obj2) {
                a((m) obj, ((Number) obj2).intValue());
                return n0.f34904a;
            }
        }

        a() {
            super(2);
        }

        public final void a(m mVar, int i10) {
            if ((i10 & 11) == 2 && mVar.v()) {
                mVar.A();
                return;
            }
            if (y0.p.H()) {
                y0.p.Q(-430891139, i10, -1, "ca.canadapost.module.customsform.enhancement.CustomsFormNewItemFragmentCompose.onCreateView.<anonymous> (CustomsFormNewItemFragmentCompose.kt:32)");
            }
            Object f10 = mVar.f();
            if (f10 == m.f51621a.a()) {
                f10 = s3.d(Boolean.TRUE, null, 2, null);
                mVar.I(f10);
            }
            q1 q1Var = (q1) f10;
            boolean booleanValue = ((Boolean) q1Var.getValue()).booleanValue();
            String string = CustomsFormNewItemFragmentCompose.this.getString(b1.f22586f0);
            t.f(string, "getString(...)");
            m7.b.a(booleanValue, string, null, new C0226a(q1Var, CustomsFormNewItemFragmentCompose.this), false, false, 0L, null, g1.c.b(mVar, 1298223126, true, new b(CustomsFormNewItemFragmentCompose.this)), mVar, 100663296, 244);
            if (y0.p.H()) {
                y0.p.P();
            }
        }

        @Override // dn.p
        public /* bridge */ /* synthetic */ Object invoke(Object obj, Object obj2) {
            a((m) obj, ((Number) obj2).intValue());
            return n0.f34904a;
        }
    }

    /* loaded from: classes4.dex */
    static final class b extends v implements l {
        b() {
            super(1);
        }

        public final void a(Boolean bool) {
            if (t.b(bool, Boolean.TRUE)) {
                CustomsFormNewItemFragmentCompose.this.C();
            }
        }

        @Override // dn.l
        public /* bridge */ /* synthetic */ Object invoke(Object obj) {
            a((Boolean) obj);
            return n0.f34904a;
        }
    }

    /* loaded from: classes4.dex */
    static final class c extends v implements l {
        c() {
            super(1);
        }

        public final void a(n0 n0Var) {
            Bundle bundle = new Bundle();
            bundle.putBoolean("addItem", false);
            j a10 = x4.d.a(CustomsFormNewItemFragmentCompose.this);
            int i10 = x0.O;
            a10.V(i10, true);
            a10.N(i10, bundle);
        }

        @Override // dn.l
        public /* bridge */ /* synthetic */ Object invoke(Object obj) {
            a((n0) obj);
            return n0.f34904a;
        }
    }

    /* loaded from: classes4.dex */
    static final class d implements g0, kotlin.jvm.internal.n {

        /* renamed from: a, reason: collision with root package name */
        private final /* synthetic */ l f8458a;

        d(l function) {
            t.g(function, "function");
            this.f8458a = function;
        }

        @Override // kotlin.jvm.internal.n
        public final i b() {
            return this.f8458a;
        }

        @Override // androidx.lifecycle.g0
        public final /* synthetic */ void d(Object obj) {
            this.f8458a.invoke(obj);
        }

        public final boolean equals(Object obj) {
            if ((obj instanceof g0) && (obj instanceof kotlin.jvm.internal.n)) {
                return t.b(b(), ((kotlin.jvm.internal.n) obj).b());
            }
            return false;
        }

        public final int hashCode() {
            return b().hashCode();
        }
    }

    /* loaded from: classes4.dex */
    public static final class e extends v implements dn.a {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ androidx.fragment.app.f f8459p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public e(androidx.fragment.app.f fVar) {
            super(0);
            this.f8459p = fVar;
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final androidx.fragment.app.f invoke() {
            return this.f8459p;
        }
    }

    /* loaded from: classes4.dex */
    public static final class f extends v implements dn.a {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ dn.a f8460p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public f(dn.a aVar) {
            super(0);
            this.f8460p = aVar;
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final d1 invoke() {
            d1 viewModelStore = ((e1) this.f8460p.invoke()).getViewModelStore();
            t.f(viewModelStore, "ownerProducer().viewModelStore");
            return viewModelStore;
        }
    }

    /* loaded from: classes4.dex */
    static final class g extends v implements dn.a {
        g() {
            super(0);
        }

        @Override // dn.a
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final c1.c invoke() {
            return CustomsFormNewItemFragmentCompose.this.y();
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public final h0 I() {
        return (h0) this.viewModel.getValue();
    }

    @Override // androidx.fragment.app.f
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        t.g(inflater, "inflater");
        return k7.a.a(this, g1.c.c(-430891139, true, new a()));
    }

    @Override // u8.b, androidx.fragment.app.f
    public void onViewCreated(View view, Bundle bundle) {
        t.g(view, "view");
        super.onViewCreated(view, bundle);
        I().i0().j(getViewLifecycleOwner(), new d(new b()));
        I().k0().j(getViewLifecycleOwner(), new d(new c()));
    }
}
