package jg;

import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.lifecycle.c1;
import ca.canadapost.core.data.model.CoreConstants;
import kotlin.Metadata;
import n8.o;

@Metadata(d1 = {"\u00008\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\u0003\n\u0002\u0018\u0002\n\u0002\b\b\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0017\u0010\u0018J&\u0010\t\u001a\u0004\u0018\u00010\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\u0016\u0010\u0010\u001a\u00020\r8\u0002@\u0002X\u0082.¢\u0006\u0006\n\u0004\b\u000e\u0010\u000fR\u001b\u0010\u0016\u001a\u00020\u00118BX\u0082\u0084\u0002¢\u0006\f\n\u0004\b\u0012\u0010\u0013\u001a\u0004\b\u0014\u0010\u0015¨\u0006\u0019"}, d2 = {"Ljg/m3;", "Lu8/b;", "Landroid/view/LayoutInflater;", "inflater", "Landroid/view/ViewGroup;", "container", "Landroid/os/Bundle;", "savedInstanceState", "Landroid/view/View;", "onCreateView", "view", "Lrm/n0;", "onViewCreated", "Lzf/w2;", "s", "Lzf/w2;", "binding", "Ljg/n3;", "t", "Lrm/o;", "J", "()Ljg/n3;", "viewModel", "<init>", "()V", "track_productionRelease"}, k = 1, mv = {1, 9, 0})
/* loaded from: classes4.dex */
public final class m3 extends u8.b {

    /* renamed from: s, reason: collision with root package name and from kotlin metadata */
    private zf.w2 binding;

    /* renamed from: t, reason: collision with root package name and from kotlin metadata */
    private final rm.o viewModel = androidx.fragment.app.p0.a(this, kotlin.jvm.internal.p0.b(n3.class), new d(new c(this)), new e());

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

        public final void a(String str) {
            if (str == null || str.length() == 0) {
                return;
            }
            o.a aVar = n8.o.f29861a;
            androidx.fragment.app.k requireActivity = m3.this.requireActivity();
            kotlin.jvm.internal.t.f(requireActivity, "requireActivity(...)");
            kotlin.jvm.internal.t.d(str);
            o.a.b(aVar, requireActivity, null, str, 2, null);
        }

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

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

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

        b(dn.l function) {
            kotlin.jvm.internal.t.g(function, "function");
            this.f24562a = function;
        }

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

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

        public final boolean equals(Object obj) {
            if ((obj instanceof androidx.lifecycle.g0) && (obj instanceof kotlin.jvm.internal.n)) {
                return kotlin.jvm.internal.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 c extends kotlin.jvm.internal.v implements dn.a {

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

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

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

    /* loaded from: classes4.dex */
    public static final class d extends kotlin.jvm.internal.v implements dn.a {

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

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

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

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

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

    private final n3 J() {
        return (n3) this.viewModel.getValue();
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void K(m3 this$0) {
        kotlin.jvm.internal.t.g(this$0, "this$0");
        zf.w2 w2Var = this$0.binding;
        if (w2Var == null) {
            kotlin.jvm.internal.t.y("binding");
            w2Var = null;
        }
        ImageView cpcTrackDncDetailTrackingBarcodeImage = w2Var.I;
        kotlin.jvm.internal.t.f(cpcTrackDncDetailTrackingBarcodeImage, "cpcTrackDncDetailTrackingBarcodeImage");
        int width = cpcTrackDncDetailTrackingBarcodeImage.getWidth();
        int height = cpcTrackDncDetailTrackingBarcodeImage.getHeight();
        w3 d02 = this$0.J().d0();
        Bitmap N0 = d02 != null ? d02.N0(width, height) : null;
        if (N0 != null) {
            ViewGroup.LayoutParams layoutParams = cpcTrackDncDetailTrackingBarcodeImage.getLayoutParams();
            layoutParams.height = (int) ((N0.getHeight() / N0.getWidth()) * width);
            cpcTrackDncDetailTrackingBarcodeImage.setLayoutParams(layoutParams);
            cpcTrackDncDetailTrackingBarcodeImage.setImageBitmap(N0);
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void L(m3 this$0, String str) {
        kotlin.jvm.internal.t.g(this$0, "this$0");
        if (str != null) {
            Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(CoreConstants.GOOGLE_PASS_SAVE + str));
            if (intent.resolveActivity(this$0.requireActivity().getPackageManager()) != null) {
                this$0.startActivity(intent);
            }
        }
    }

    @Override // androidx.fragment.app.f
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        kotlin.jvm.internal.t.g(inflater, "inflater");
        androidx.databinding.n h10 = androidx.databinding.f.h(inflater, yf.e.f52497a0, container, false);
        kotlin.jvm.internal.t.f(h10, "inflate(...)");
        zf.w2 w2Var = (zf.w2) h10;
        this.binding = w2Var;
        zf.w2 w2Var2 = null;
        if (w2Var == null) {
            kotlin.jvm.internal.t.y("binding");
            w2Var = null;
        }
        w2Var.O(getViewLifecycleOwner());
        zf.w2 w2Var3 = this.binding;
        if (w2Var3 == null) {
            kotlin.jvm.internal.t.y("binding");
            w2Var3 = null;
        }
        w2Var3.U(J());
        zf.w2 w2Var4 = this.binding;
        if (w2Var4 == null) {
            kotlin.jvm.internal.t.y("binding");
        } else {
            w2Var2 = w2Var4;
        }
        return w2Var2.x();
    }

    @Override // u8.b, androidx.fragment.app.f
    public void onViewCreated(View view, Bundle bundle) {
        androidx.lifecycle.f0 Z0;
        kotlin.jvm.internal.t.g(view, "view");
        super.onViewCreated(view, bundle);
        w3 d02 = J().d0();
        zf.w2 w2Var = null;
        if (((d02 == null || (Z0 = d02.Z0()) == null) ? null : (String) Z0.f()) != null) {
            zf.w2 w2Var2 = this.binding;
            if (w2Var2 == null) {
                kotlin.jvm.internal.t.y("binding");
                w2Var2 = null;
            }
            w2Var2.H.setVisibility(0);
            zf.w2 w2Var3 = this.binding;
            if (w2Var3 == null) {
                kotlin.jvm.internal.t.y("binding");
                w2Var3 = null;
            }
            w2Var3.f53441f0.setVisibility(8);
        } else {
            zf.w2 w2Var4 = this.binding;
            if (w2Var4 == null) {
                kotlin.jvm.internal.t.y("binding");
                w2Var4 = null;
            }
            w2Var4.H.setVisibility(8);
            zf.w2 w2Var5 = this.binding;
            if (w2Var5 == null) {
                kotlin.jvm.internal.t.y("binding");
                w2Var5 = null;
            }
            w2Var5.f53441f0.setVisibility(0);
        }
        zf.w2 w2Var6 = this.binding;
        if (w2Var6 == null) {
            kotlin.jvm.internal.t.y("binding");
        } else {
            w2Var = w2Var6;
        }
        w2Var.I.post(new Runnable() { // from class: jg.k3
            @Override // java.lang.Runnable
            public final void run() {
                m3.K(m3.this);
            }
        });
        J().W().j(getViewLifecycleOwner(), new androidx.lifecycle.g0() { // from class: jg.l3
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                m3.L(m3.this, (String) obj);
            }
        });
        J().Y().j(getViewLifecycleOwner(), new b(new a()));
    }
}
