package od;

import android.text.Html;
import android.text.Spanned;
import android.util.SparseIntArray;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.databinding.n;
import ca.canadapost.core.common.customView.CpcTextInput;
import ca.canadapost.core.common.ui.CpcFragmentContainerView;
import ud.a;

/* loaded from: classes4.dex */
public class r0 extends q0 implements a.InterfaceC0889a {
    private static final n.i M;
    private static final SparseIntArray N;
    private final CpcFragmentContainerView H;
    private final LinearLayout I;
    private final View.OnClickListener J;
    private androidx.databinding.g K;
    private long L;

    /* loaded from: classes4.dex */
    class a implements androidx.databinding.g {
        a() {
        }

        @Override // androidx.databinding.g
        public void a() {
            String a10 = ca.canadapost.core.common.customView.u.a(r0.this.B);
            vd.m mVar = r0.this.G;
            if (mVar != null) {
                androidx.lifecycle.f0 f02 = mVar.f0();
                if (f02 != null) {
                    f02.q(a10);
                }
            }
        }
    }

    static {
        n.i iVar = new n.i(8);
        M = iVar;
        iVar.a(1, new String[]{"cpc_agree_tnc_layout"}, new int[]{6}, new int[]{h7.j.f21089d});
        SparseIntArray sparseIntArray = new SparseIntArray();
        N = sparseIntArray;
        sparseIntArray.put(ld.j.f27917d0, 7);
    }

    public r0(androidx.databinding.e eVar, View view) {
        this(eVar, view, androidx.databinding.n.E(eVar, view, 8, M, N));
    }

    private boolean U(androidx.lifecycle.f0 f0Var, int i10) {
        if (i10 != ld.a.f27861a) {
            return false;
        }
        synchronized (this) {
            this.L |= 2;
        }
        return true;
    }

    private boolean V(androidx.lifecycle.f0 f0Var, int i10) {
        if (i10 != ld.a.f27861a) {
            return false;
        }
        synchronized (this) {
            this.L |= 1;
        }
        return true;
    }

    private boolean W(u7.h hVar, int i10) {
        if (i10 != ld.a.f27861a) {
            return false;
        }
        synchronized (this) {
            this.L |= 4;
        }
        return true;
    }

    @Override // androidx.databinding.n
    public void B() {
        synchronized (this) {
            this.L = 16L;
        }
        this.C.B();
        J();
    }

    @Override // androidx.databinding.n
    protected boolean F(int i10, Object obj, int i11) {
        if (i10 == 0) {
            return V((androidx.lifecycle.f0) obj, i11);
        }
        if (i10 == 1) {
            return U((androidx.lifecycle.f0) obj, i11);
        }
        if (i10 != 2) {
            return false;
        }
        return W((u7.h) obj, i11);
    }

    @Override // androidx.databinding.n
    public void O(androidx.lifecycle.u uVar) {
        super.O(uVar);
        this.C.O(uVar);
    }

    @Override // androidx.databinding.n
    public boolean Q(int i10, Object obj) {
        if (ld.a.f27862b != i10) {
            return false;
        }
        X((vd.m) obj);
        return true;
    }

    public void X(vd.m mVar) {
        this.G = mVar;
        synchronized (this) {
            this.L |= 8;
        }
        f(ld.a.f27862b);
        super.J();
    }

    @Override // ud.a.InterfaceC0889a
    public final void a(int i10, View view) {
        vd.m mVar = this.G;
        if (mVar != null) {
            mVar.l0();
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x0079  */
    /* JADX WARN: Removed duplicated region for block: B:30:0x009f  */
    /* JADX WARN: Removed duplicated region for block: B:33:0x00b2  */
    /* JADX WARN: Removed duplicated region for block: B:36:0x00bc  */
    /* JADX WARN: Removed duplicated region for block: B:39:0x00c8  */
    /* JADX WARN: Removed duplicated region for block: B:44:0x0090  */
    @Override // androidx.databinding.n
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    protected void n() {
        long j10;
        Spanned spanned;
        Spanned spanned2;
        String str;
        androidx.lifecycle.f0 f0Var;
        Spanned spanned3;
        String str2;
        String str3;
        String str4;
        synchronized (this) {
            j10 = this.L;
            this.L = 0L;
        }
        vd.m mVar = this.G;
        if ((27 & j10) != 0) {
            if ((j10 & 24) != 0) {
                if (mVar != null) {
                    str3 = mVar.b0();
                    str4 = mVar.h0();
                } else {
                    str3 = null;
                    str4 = null;
                }
                String string = this.D.getResources().getString(ld.m.J, str3);
                String string2 = this.F.getResources().getString(ld.m.K, str4);
                spanned = Html.fromHtml(string);
                spanned3 = Html.fromHtml(string2);
            } else {
                spanned = null;
                spanned3 = null;
            }
            if ((j10 & 25) != 0) {
                androidx.lifecycle.a0 g02 = mVar != null ? mVar.g0() : null;
                S(0, g02);
                if (g02 != null) {
                    str2 = (String) g02.f();
                    if ((j10 & 26) == 0) {
                        f0Var = mVar != null ? mVar.f0() : null;
                        S(1, f0Var);
                        if (f0Var != null) {
                        }
                        spanned2 = spanned3;
                        str = str2;
                        if ((j10 & 16) != 0) {
                            this.A.setOnClickListener(this.J);
                            ca.canadapost.core.common.customView.u.e(this.B, this.K);
                        }
                        if ((25 & j10) != 0) {
                            ca.canadapost.core.common.customView.u.d(this.B, str);
                        }
                        if ((26 & j10) != 0) {
                            ca.canadapost.core.common.customView.u.b(this.B, f0Var);
                        }
                        if ((j10 & 24) != 0) {
                            this.C.U(mVar);
                            b4.e.e(this.D, spanned);
                            b4.e.e(this.F, spanned2);
                        }
                        androidx.databinding.n.p(this.C);
                    }
                    spanned2 = spanned3;
                    str = str2;
                }
            }
            str2 = null;
            if ((j10 & 26) == 0) {
            }
        } else {
            spanned = null;
            spanned2 = null;
            str = null;
        }
        f0Var = null;
        if ((j10 & 16) != 0) {
        }
        if ((25 & j10) != 0) {
        }
        if ((26 & j10) != 0) {
        }
        if ((j10 & 24) != 0) {
        }
        androidx.databinding.n.p(this.C);
    }

    @Override // androidx.databinding.n
    public boolean z() {
        synchronized (this) {
            if (this.L != 0) {
                return true;
            }
            return this.C.z();
        }
    }

    private r0(androidx.databinding.e eVar, View view, Object[] objArr) {
        super(eVar, view, 3, (Button) objArr[5], (CpcTextInput) objArr[4], (u7.h) objArr[6], (TextView) objArr[2], (TextView) objArr[7], (TextView) objArr[3]);
        this.K = new a();
        this.L = -1L;
        this.A.setTag(null);
        this.B.setTag(null);
        CpcFragmentContainerView cpcFragmentContainerView = (CpcFragmentContainerView) objArr[0];
        this.H = cpcFragmentContainerView;
        cpcFragmentContainerView.setTag(null);
        LinearLayout linearLayout = (LinearLayout) objArr[1];
        this.I = linearLayout;
        linearLayout.setTag(null);
        N(this.C);
        this.D.setTag(null);
        this.F.setTag(null);
        P(view);
        this.J = new ud.a(this, 1);
        B();
    }
}
