package e8;

import androidx.lifecycle.a0;
import androidx.lifecycle.g0;
import androidx.lifecycle.y0;
import ca.canadapost.core.data.flex.model.FlexLocation;
import ca.canadapost.core.data.flex.model.FlexService;
import ca.canadapost.core.data.model.PickUpLocationFlow;
import dn.l;
import kotlin.jvm.internal.t;
import kotlin.jvm.internal.v;

/* loaded from: classes.dex */
public final class d extends a8.b {

    /* renamed from: o, reason: collision with root package name */
    private final d9.f f16849o;

    /* renamed from: p, reason: collision with root package name */
    private final PickUpLocationFlow f16850p;

    /* renamed from: q, reason: collision with root package name */
    private final a0 f16851q;

    /* renamed from: r, reason: collision with root package name */
    private final l8.g f16852r;

    /* renamed from: s, reason: collision with root package name */
    private final a0 f16853s;

    /* renamed from: t, reason: collision with root package name */
    private final g0 f16854t;

    /* loaded from: classes.dex */
    static final class a extends v implements l {

        /* renamed from: p, reason: collision with root package name */
        final /* synthetic */ v9.d f16855p;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        a(v9.d dVar) {
            super(1);
            this.f16855p = dVar;
        }

        @Override // dn.l
        /* renamed from: a, reason: merged with bridge method [inline-methods] */
        public final Boolean invoke(FlexLocation.FlexLocationItem flexLocationItem) {
            return Boolean.valueOf(this.f16855p.v().f() == FlexService.APL);
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public d(v9.d repository, t7.c contextService, ca.a languageService, d9.f analyticsService, PickUpLocationFlow pickUpFlow) {
        super(repository, contextService, languageService);
        t.g(repository, "repository");
        t.g(contextService, "contextService");
        t.g(languageService, "languageService");
        t.g(analyticsService, "analyticsService");
        t.g(pickUpFlow, "pickUpFlow");
        this.f16849o = analyticsService;
        this.f16850p = pickUpFlow;
        this.f16851q = y0.a(a0(), new a(repository));
        l8.g gVar = new l8.g();
        this.f16852r = gVar;
        this.f16853s = gVar;
        g0 g0Var = new g0() { // from class: e8.c
            @Override // androidx.lifecycle.g0
            public final void d(Object obj) {
                d.l0(d.this, (FlexLocation.FlexLocationItem) obj);
            }
        };
        repository.n().k(g0Var);
        this.f16854t = g0Var;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void l0(d this$0, FlexLocation.FlexLocationItem flexLocationItem) {
        t.g(this$0, "this$0");
        if (flexLocationItem == null) {
            this$0.f16852r.s();
            return;
        }
        this$0.e0(flexLocationItem.getServiceTypes());
        this$0.d0(flexLocationItem.getAddress());
        this$0.g0(flexLocationItem.getSupportedLanguage());
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // androidx.lifecycle.z0
    public void O() {
        Y().n().o(this.f16854t);
        if (this.f16850p == PickUpLocationFlow.HOME) {
            Y().l();
        }
        super.O();
    }

    public final a0 i0() {
        return this.f16853s;
    }

    public final PickUpLocationFlow j0() {
        return this.f16850p;
    }

    public final a0 k0() {
        return this.f16851q;
    }
}
