package androidx.fragment.app;

import android.content.Context;
import android.graphics.Rect;
import android.os.Build;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.AbstractC0377u;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import p011d0.C0605h;
import p023h0.C0829h1;
import p023h0.ViewTreeObserver$OnPreDrawListenerC0801d1;
import p037m.C1444a;

/* renamed from: androidx.fragment.app.v */
/* loaded from: classes.dex */
public class C0379v {

    /* renamed from: a */
    public static final int[] f1529a = {0, 3, 0, 1, 5, 4, 7, 6, 9, 8, 10};

    /* renamed from: b */
    public static final AbstractC0349n0 f1530b;

    /* renamed from: c */
    public static final AbstractC0349n0 f1531c;

    /* renamed from: androidx.fragment.app.v$a */
    /* loaded from: classes.dex */
    public class RunnableC0380a implements Runnable {

        /* renamed from: d */
        public final /* synthetic */ InterfaceC0386g f1532d;

        /* renamed from: e */
        public final /* synthetic */ Fragment f1533e;

        /* renamed from: f */
        public final /* synthetic */ C0605h f1534f;

        public RunnableC0380a(InterfaceC0386g interfaceC0386g, Fragment fragment, C0605h c0605h) {
            this.f1532d = interfaceC0386g;
            this.f1533e = fragment;
            this.f1534f = c0605h;
        }

        @Override // java.lang.Runnable
        public void run() {
            this.f1532d.mo3758a(this.f1533e, this.f1534f);
        }
    }

    /* renamed from: androidx.fragment.app.v$b */
    /* loaded from: classes.dex */
    public class RunnableC0381b implements Runnable {

        /* renamed from: d */
        public final /* synthetic */ ArrayList f1535d;

        public RunnableC0381b(ArrayList arrayList) {
            this.f1535d = arrayList;
        }

        @Override // java.lang.Runnable
        public void run() {
            C0379v.m3786A(this.f1535d, 4);
        }
    }

    /* renamed from: androidx.fragment.app.v$c */
    /* loaded from: classes.dex */
    public class RunnableC0382c implements Runnable {

        /* renamed from: d */
        public final /* synthetic */ InterfaceC0386g f1536d;

        /* renamed from: e */
        public final /* synthetic */ Fragment f1537e;

        /* renamed from: f */
        public final /* synthetic */ C0605h f1538f;

        public RunnableC0382c(InterfaceC0386g interfaceC0386g, Fragment fragment, C0605h c0605h) {
            this.f1536d = interfaceC0386g;
            this.f1537e = fragment;
            this.f1538f = c0605h;
        }

        @Override // java.lang.Runnable
        public void run() {
            this.f1536d.mo3758a(this.f1537e, this.f1538f);
        }
    }

    /* renamed from: androidx.fragment.app.v$d */
    /* loaded from: classes.dex */
    public class RunnableC0383d implements Runnable {

        /* renamed from: d */
        public final /* synthetic */ Object f1539d;

        /* renamed from: e */
        public final /* synthetic */ AbstractC0349n0 f1540e;

        /* renamed from: f */
        public final /* synthetic */ View f1541f;

        /* renamed from: g */
        public final /* synthetic */ Fragment f1542g;

        /* renamed from: h */
        public final /* synthetic */ ArrayList f1543h;

        /* renamed from: i */
        public final /* synthetic */ ArrayList f1544i;

        /* renamed from: j */
        public final /* synthetic */ ArrayList f1545j;

        /* renamed from: k */
        public final /* synthetic */ Object f1546k;

        public RunnableC0383d(Object obj, AbstractC0349n0 abstractC0349n0, View view, Fragment fragment, ArrayList arrayList, ArrayList arrayList2, ArrayList arrayList3, Object obj2) {
            this.f1539d = obj;
            this.f1540e = abstractC0349n0;
            this.f1541f = view;
            this.f1542g = fragment;
            this.f1543h = arrayList;
            this.f1544i = arrayList2;
            this.f1545j = arrayList3;
            this.f1546k = obj2;
        }

        @Override // java.lang.Runnable
        public void run() {
            Object obj = this.f1539d;
            if (obj != null) {
                this.f1540e.mo3907p(obj, this.f1541f);
                this.f1544i.addAll(C0379v.m3774k(this.f1540e, this.f1539d, this.f1542g, this.f1543h, this.f1541f));
            }
            if (this.f1545j != null) {
                if (this.f1546k != null) {
                    ArrayList<View> arrayList = new ArrayList<>();
                    arrayList.add(this.f1541f);
                    this.f1540e.mo3906q(this.f1546k, this.f1545j, arrayList);
                }
                this.f1545j.clear();
                this.f1545j.add(this.f1541f);
            }
        }
    }

    /* renamed from: androidx.fragment.app.v$e */
    /* loaded from: classes.dex */
    public class RunnableC0384e implements Runnable {

        /* renamed from: d */
        public final /* synthetic */ Fragment f1547d;

        /* renamed from: e */
        public final /* synthetic */ Fragment f1548e;

        /* renamed from: f */
        public final /* synthetic */ boolean f1549f;

        /* renamed from: g */
        public final /* synthetic */ C1444a f1550g;

        /* renamed from: h */
        public final /* synthetic */ View f1551h;

        /* renamed from: i */
        public final /* synthetic */ AbstractC0349n0 f1552i;

        /* renamed from: j */
        public final /* synthetic */ Rect f1553j;

        public RunnableC0384e(Fragment fragment, Fragment fragment2, boolean z, C1444a c1444a, View view, AbstractC0349n0 abstractC0349n0, Rect rect) {
            this.f1547d = fragment;
            this.f1548e = fragment2;
            this.f1549f = z;
            this.f1550g = c1444a;
            this.f1551h = view;
            this.f1552i = abstractC0349n0;
            this.f1553j = rect;
        }

        @Override // java.lang.Runnable
        public void run() {
            C0379v.m3779f(this.f1547d, this.f1548e, this.f1549f, this.f1550g, false);
            View view = this.f1551h;
            if (view != null) {
                this.f1552i.m3912k(view, this.f1553j);
            }
        }
    }

    /* renamed from: androidx.fragment.app.v$f */
    /* loaded from: classes.dex */
    public class RunnableC0385f implements Runnable {

        /* renamed from: d */
        public final /* synthetic */ AbstractC0349n0 f1554d;

        /* renamed from: e */
        public final /* synthetic */ C1444a f1555e;

        /* renamed from: f */
        public final /* synthetic */ Object f1556f;

        /* renamed from: g */
        public final /* synthetic */ C0387h f1557g;

        /* renamed from: h */
        public final /* synthetic */ ArrayList f1558h;

        /* renamed from: i */
        public final /* synthetic */ View f1559i;

        /* renamed from: j */
        public final /* synthetic */ Fragment f1560j;

        /* renamed from: k */
        public final /* synthetic */ Fragment f1561k;

        /* renamed from: l */
        public final /* synthetic */ boolean f1562l;

        /* renamed from: m */
        public final /* synthetic */ ArrayList f1563m;

        /* renamed from: n */
        public final /* synthetic */ Object f1564n;

        /* renamed from: o */
        public final /* synthetic */ Rect f1565o;

        public RunnableC0385f(AbstractC0349n0 abstractC0349n0, C1444a c1444a, Object obj, C0387h c0387h, ArrayList arrayList, View view, Fragment fragment, Fragment fragment2, boolean z, ArrayList arrayList2, Object obj2, Rect rect) {
            this.f1554d = abstractC0349n0;
            this.f1555e = c1444a;
            this.f1556f = obj;
            this.f1557g = c0387h;
            this.f1558h = arrayList;
            this.f1559i = view;
            this.f1560j = fragment;
            this.f1561k = fragment2;
            this.f1562l = z;
            this.f1563m = arrayList2;
            this.f1564n = obj2;
            this.f1565o = rect;
        }

        @Override // java.lang.Runnable
        public void run() {
            C1444a<String, View> m3777h = C0379v.m3777h(this.f1554d, this.f1555e, this.f1556f, this.f1557g);
            if (m3777h != null) {
                this.f1558h.addAll(m3777h.values());
                this.f1558h.add(this.f1559i);
            }
            C0379v.m3779f(this.f1560j, this.f1561k, this.f1562l, m3777h, false);
            Object obj = this.f1556f;
            if (obj != null) {
                this.f1554d.mo3924A(obj, this.f1563m, this.f1558h);
                View m3766s = C0379v.m3766s(m3777h, this.f1557g, this.f1564n, this.f1562l);
                if (m3766s != null) {
                    this.f1554d.m3912k(m3766s, this.f1565o);
                }
            }
        }
    }

    /* renamed from: androidx.fragment.app.v$g */
    /* loaded from: classes.dex */
    public interface InterfaceC0386g {
        /* renamed from: a */
        void mo3758a(Fragment fragment, C0605h c0605h);

        /* renamed from: b */
        void mo3757b(Fragment fragment, C0605h c0605h);
    }

    /* renamed from: androidx.fragment.app.v$h */
    /* loaded from: classes.dex */
    public static class C0387h {

        /* renamed from: a */
        public Fragment f1566a;

        /* renamed from: b */
        public boolean f1567b;

        /* renamed from: c */
        public C0275a f1568c;

        /* renamed from: d */
        public Fragment f1569d;

        /* renamed from: e */
        public boolean f1570e;

        /* renamed from: f */
        public C0275a f1571f;
    }

    static {
        f1530b = Build.VERSION.SDK_INT >= 21 ? new C0324l0() : null;
        f1531c = m3762w();
    }

    /* renamed from: A */
    public static void m3786A(ArrayList<View> arrayList, int i) {
        if (arrayList == null) {
            return;
        }
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            arrayList.get(size).setVisibility(i);
        }
    }

    /* renamed from: B */
    public static void m3785B(Context context, AbstractC0309f abstractC0309f, ArrayList<C0275a> arrayList, ArrayList<Boolean> arrayList2, int i, int i2, boolean z, InterfaceC0386g interfaceC0386g) {
        ViewGroup viewGroup;
        SparseArray sparseArray = new SparseArray();
        for (int i3 = i; i3 < i2; i3++) {
            C0275a c0275a = arrayList.get(i3);
            if (arrayList2.get(i3).booleanValue()) {
                m3780e(c0275a, sparseArray, z);
            } else {
                m3782c(c0275a, sparseArray, z);
            }
        }
        if (sparseArray.size() != 0) {
            View view = new View(context);
            int size = sparseArray.size();
            for (int i4 = 0; i4 < size; i4++) {
                int keyAt = sparseArray.keyAt(i4);
                C1444a<String, String> m3781d = m3781d(keyAt, arrayList, arrayList2, i, i2);
                C0387h c0387h = (C0387h) sparseArray.valueAt(i4);
                if (abstractC0309f.mo4077h() && (viewGroup = (ViewGroup) abstractC0309f.mo4078g(keyAt)) != null) {
                    if (z) {
                        m3770o(viewGroup, c0387h, view, m3781d, interfaceC0386g);
                    } else {
                        m3771n(viewGroup, c0387h, view, m3781d, interfaceC0386g);
                    }
                }
            }
        }
    }

    /* renamed from: a */
    public static void m3784a(ArrayList<View> arrayList, C1444a<String, View> c1444a, Collection<String> collection) {
        for (int size = c1444a.size() - 1; size >= 0; size--) {
            View m1319l = c1444a.m1319l(size);
            if (collection.contains(C0829h1.m2811w(m1319l))) {
                arrayList.add(m1319l);
            }
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:31:0x0039, code lost:
        if (r0.f1192o != false) goto L60;
     */
    /* JADX WARN: Code restructure failed: missing block: B:56:0x006e, code lost:
        r9 = true;
     */
    /* JADX WARN: Code restructure failed: missing block: B:68:0x0088, code lost:
        if (r0.f1154C == false) goto L60;
     */
    /* JADX WARN: Code restructure failed: missing block: B:69:0x008a, code lost:
        r9 = true;
     */
    /* JADX WARN: Removed duplicated region for block: B:74:0x0098  */
    /* JADX WARN: Removed duplicated region for block: B:77:0x00a5 A[ADDED_TO_REGION] */
    /* JADX WARN: Removed duplicated region for block: B:84:0x00b3  */
    /* JADX WARN: Removed duplicated region for block: B:86:0x00c5 A[ADDED_TO_REGION] */
    /* JADX WARN: Removed duplicated region for block: B:91:0x00d7 A[ADDED_TO_REGION] */
    /* JADX WARN: Removed duplicated region for block: B:97:? A[ADDED_TO_REGION, RETURN, SYNTHETIC] */
    /* renamed from: b */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static void m3783b(C0275a c0275a, AbstractC0377u.C0378a c0378a, SparseArray<C0387h> sparseArray, boolean z, boolean z2) {
        int i;
        boolean z3;
        boolean z4;
        boolean z5;
        C0387h c0387h;
        Fragment fragment = c0378a.f1522b;
        if (fragment == null || (i = fragment.f1152A) == 0) {
            return;
        }
        int i2 = z ? f1529a[c0378a.f1521a] : c0378a.f1521a;
        boolean z6 = false;
        boolean z7 = true;
        if (i2 != 1) {
            if (i2 != 3) {
                if (i2 == 4) {
                    boolean z8 = !z2 ? false : false;
                    z5 = z8;
                    z4 = true;
                    z7 = false;
                    c0387h = sparseArray.get(i);
                    if (z6) {
                    }
                    if (!z2) {
                    }
                    if (z5) {
                    }
                    if (z2) {
                    }
                } else if (i2 != 5) {
                    if (i2 != 6) {
                        if (i2 != 7) {
                            z4 = false;
                            z7 = false;
                            z5 = false;
                            c0387h = sparseArray.get(i);
                            if (z6) {
                                c0387h = m3769p(c0387h, sparseArray, i);
                                c0387h.f1566a = fragment;
                                c0387h.f1567b = z;
                                c0387h.f1568c = c0275a;
                            }
                            if (!z2 && z7) {
                                if (c0387h != null && c0387h.f1569d == fragment) {
                                    c0387h.f1569d = null;
                                }
                                if (!c0275a.f1519r) {
                                    AbstractC0330m abstractC0330m = c0275a.f1236t;
                                    abstractC0330m.m3965n0().m3802p(abstractC0330m.m3954t(fragment));
                                    abstractC0330m.m4031K0(fragment);
                                }
                            }
                            if (z5 && (c0387h == null || c0387h.f1569d == null)) {
                                c0387h = m3769p(c0387h, sparseArray, i);
                                c0387h.f1569d = fragment;
                                c0387h.f1570e = z;
                                c0387h.f1571f = c0275a;
                            }
                            if (z2 || !z4 || c0387h == null || c0387h.f1566a != fragment) {
                                return;
                            }
                            c0387h.f1566a = null;
                            return;
                        }
                    }
                } else if (z2) {
                    if (fragment.f1168Q) {
                        if (!fragment.f1154C) {
                        }
                    }
                    z3 = false;
                    z6 = z3;
                    z4 = false;
                    z5 = false;
                    c0387h = sparseArray.get(i);
                    if (z6) {
                    }
                    if (!z2) {
                        if (c0387h != null) {
                            c0387h.f1569d = null;
                        }
                        if (!c0275a.f1519r) {
                        }
                    }
                    if (z5) {
                        c0387h = m3769p(c0387h, sparseArray, i);
                        c0387h.f1569d = fragment;
                        c0387h.f1570e = z;
                        c0387h.f1571f = c0275a;
                    }
                    if (z2) {
                        return;
                    }
                    return;
                } else {
                    z3 = fragment.f1154C;
                    z6 = z3;
                    z4 = false;
                    z5 = false;
                    c0387h = sparseArray.get(i);
                    if (z6) {
                    }
                    if (!z2) {
                    }
                    if (z5) {
                    }
                    if (z2) {
                    }
                }
            }
            boolean z9 = fragment.f1192o;
            if (!z2) {
            }
            z5 = z8;
            z4 = true;
            z7 = false;
            c0387h = sparseArray.get(i);
            if (z6) {
            }
            if (!z2) {
            }
            if (z5) {
            }
            if (z2) {
            }
        }
        if (z2) {
            z3 = fragment.f1167P;
            z6 = z3;
            z4 = false;
            z5 = false;
            c0387h = sparseArray.get(i);
            if (z6) {
            }
            if (!z2) {
            }
            if (z5) {
            }
            if (z2) {
            }
        } else {
            if (!fragment.f1192o) {
            }
            z3 = false;
            z6 = z3;
            z4 = false;
            z5 = false;
            c0387h = sparseArray.get(i);
            if (z6) {
            }
            if (!z2) {
            }
            if (z5) {
            }
            if (z2) {
            }
        }
    }

    /* renamed from: c */
    public static void m3782c(C0275a c0275a, SparseArray<C0387h> sparseArray, boolean z) {
        int size = c0275a.f1504c.size();
        for (int i = 0; i < size; i++) {
            m3783b(c0275a, c0275a.f1504c.get(i), sparseArray, false, z);
        }
    }

    /* renamed from: d */
    public static C1444a<String, String> m3781d(int i, ArrayList<C0275a> arrayList, ArrayList<Boolean> arrayList2, int i2, int i3) {
        ArrayList<String> arrayList3;
        ArrayList<String> arrayList4;
        C1444a<String, String> c1444a = new C1444a<>();
        for (int i4 = i3 - 1; i4 >= i2; i4--) {
            C0275a c0275a = arrayList.get(i4);
            if (c0275a.m4158p(i)) {
                boolean booleanValue = arrayList2.get(i4).booleanValue();
                ArrayList<String> arrayList5 = c0275a.f1517p;
                if (arrayList5 != null) {
                    int size = arrayList5.size();
                    if (booleanValue) {
                        arrayList3 = c0275a.f1517p;
                        arrayList4 = c0275a.f1518q;
                    } else {
                        ArrayList<String> arrayList6 = c0275a.f1517p;
                        arrayList3 = c0275a.f1518q;
                        arrayList4 = arrayList6;
                    }
                    for (int i5 = 0; i5 < size; i5++) {
                        String str = arrayList4.get(i5);
                        String str2 = arrayList3.get(i5);
                        String remove = c1444a.remove(str2);
                        if (remove != null) {
                            c1444a.put(str, remove);
                        } else {
                            c1444a.put(str, str2);
                        }
                    }
                }
            }
        }
        return c1444a;
    }

    /* renamed from: e */
    public static void m3780e(C0275a c0275a, SparseArray<C0387h> sparseArray, boolean z) {
        if (c0275a.f1236t.m3971k0().mo4077h()) {
            for (int size = c0275a.f1504c.size() - 1; size >= 0; size--) {
                m3783b(c0275a, c0275a.f1504c.get(size), sparseArray, true, z);
            }
        }
    }

    /* renamed from: f */
    public static void m3779f(Fragment fragment, Fragment fragment2, boolean z, C1444a<String, View> c1444a, boolean z2) {
        if (z) {
            fragment2.m4186t();
        } else {
            fragment.m4186t();
        }
    }

    /* renamed from: g */
    public static boolean m3778g(AbstractC0349n0 abstractC0349n0, List<Object> list) {
        int size = list.size();
        for (int i = 0; i < size; i++) {
            if (!abstractC0349n0.mo3918e(list.get(i))) {
                return false;
            }
        }
        return true;
    }

    /* renamed from: h */
    public static C1444a<String, View> m3777h(AbstractC0349n0 abstractC0349n0, C1444a<String, String> c1444a, Object obj, C0387h c0387h) {
        ArrayList<String> arrayList;
        Fragment fragment = c0387h.f1566a;
        View m4258Q = fragment.m4258Q();
        if (c1444a.isEmpty() || obj == null || m4258Q == null) {
            c1444a.clear();
            return null;
        }
        C1444a<String, View> c1444a2 = new C1444a<>();
        abstractC0349n0.m3913j(c1444a2, m4258Q);
        C0275a c0275a = c0387h.f1568c;
        if (c0387h.f1567b) {
            fragment.m4177w();
            arrayList = c0275a.f1517p;
        } else {
            fragment.m4186t();
            arrayList = c0275a.f1518q;
        }
        if (arrayList != null) {
            c1444a2.m1383n(arrayList);
            c1444a2.m1383n(c1444a.values());
        }
        m3761x(c1444a, c1444a2);
        return c1444a2;
    }

    /* renamed from: i */
    public static C1444a<String, View> m3776i(AbstractC0349n0 abstractC0349n0, C1444a<String, String> c1444a, Object obj, C0387h c0387h) {
        ArrayList<String> arrayList;
        if (c1444a.isEmpty() || obj == null) {
            c1444a.clear();
            return null;
        }
        Fragment fragment = c0387h.f1569d;
        C1444a<String, View> c1444a2 = new C1444a<>();
        abstractC0349n0.m3913j(c1444a2, fragment.m4214j1());
        C0275a c0275a = c0387h.f1571f;
        if (c0387h.f1570e) {
            fragment.m4186t();
            arrayList = c0275a.f1518q;
        } else {
            fragment.m4177w();
            arrayList = c0275a.f1517p;
        }
        if (arrayList != null) {
            c1444a2.m1383n(arrayList);
        }
        c1444a.m1383n(c1444a2.keySet());
        return c1444a2;
    }

    /* renamed from: j */
    public static AbstractC0349n0 m3775j(Fragment fragment, Fragment fragment2) {
        ArrayList arrayList = new ArrayList();
        if (fragment != null) {
            Object m4180v = fragment.m4180v();
            if (m4180v != null) {
                arrayList.add(m4180v);
            }
            Object m4270K = fragment.m4270K();
            if (m4270K != null) {
                arrayList.add(m4270K);
            }
            Object m4266M = fragment.m4266M();
            if (m4266M != null) {
                arrayList.add(m4266M);
            }
        }
        if (fragment2 != null) {
            Object m4189s = fragment2.m4189s();
            if (m4189s != null) {
                arrayList.add(m4189s);
            }
            Object m4274I = fragment2.m4274I();
            if (m4274I != null) {
                arrayList.add(m4274I);
            }
            Object m4268L = fragment2.m4268L();
            if (m4268L != null) {
                arrayList.add(m4268L);
            }
        }
        if (arrayList.isEmpty()) {
            return null;
        }
        AbstractC0349n0 abstractC0349n0 = f1530b;
        if (abstractC0349n0 == null || !m3778g(abstractC0349n0, arrayList)) {
            AbstractC0349n0 abstractC0349n02 = f1531c;
            if (abstractC0349n02 == null || !m3778g(abstractC0349n02, arrayList)) {
                if (abstractC0349n0 == null && abstractC0349n02 == null) {
                    return null;
                }
                throw new IllegalArgumentException("Invalid Transition types");
            }
            return abstractC0349n02;
        }
        return abstractC0349n0;
    }

    /* renamed from: k */
    public static ArrayList<View> m3774k(AbstractC0349n0 abstractC0349n0, Object obj, Fragment fragment, ArrayList<View> arrayList, View view) {
        if (obj != null) {
            ArrayList<View> arrayList2 = new ArrayList<>();
            View m4258Q = fragment.m4258Q();
            if (m4258Q != null) {
                abstractC0349n0.m3917f(arrayList2, m4258Q);
            }
            if (arrayList != null) {
                arrayList2.removeAll(arrayList);
            }
            if (arrayList2.isEmpty()) {
                return arrayList2;
            }
            arrayList2.add(view);
            abstractC0349n0.mo3921b(obj, arrayList2);
            return arrayList2;
        }
        return null;
    }

    /* renamed from: l */
    public static Object m3773l(AbstractC0349n0 abstractC0349n0, ViewGroup viewGroup, View view, C1444a<String, String> c1444a, C0387h c0387h, ArrayList<View> arrayList, ArrayList<View> arrayList2, Object obj, Object obj2) {
        Object m3765t;
        C1444a<String, String> c1444a2;
        Object obj3;
        Rect rect;
        Fragment fragment = c0387h.f1566a;
        Fragment fragment2 = c0387h.f1569d;
        if (fragment == null || fragment2 == null) {
            return null;
        }
        boolean z = c0387h.f1567b;
        if (c1444a.isEmpty()) {
            c1444a2 = c1444a;
            m3765t = null;
        } else {
            m3765t = m3765t(abstractC0349n0, fragment, fragment2, z);
            c1444a2 = c1444a;
        }
        C1444a<String, View> m3776i = m3776i(abstractC0349n0, c1444a2, m3765t, c0387h);
        if (c1444a.isEmpty()) {
            obj3 = null;
        } else {
            arrayList.addAll(m3776i.values());
            obj3 = m3765t;
        }
        if (obj == null && obj2 == null && obj3 == null) {
            return null;
        }
        m3779f(fragment, fragment2, z, m3776i, true);
        if (obj3 != null) {
            rect = new Rect();
            abstractC0349n0.mo3897z(obj3, view, arrayList);
            m3759z(abstractC0349n0, obj3, obj2, m3776i, c0387h.f1570e, c0387h.f1571f);
            if (obj != null) {
                abstractC0349n0.mo3902u(obj, rect);
            }
        } else {
            rect = null;
        }
        ViewTreeObserver$OnPreDrawListenerC0801d1.m2889a(viewGroup, new RunnableC0385f(abstractC0349n0, c1444a, obj3, c0387h, arrayList2, view, fragment, fragment2, z, arrayList, obj, rect));
        return obj3;
    }

    /* renamed from: m */
    public static Object m3772m(AbstractC0349n0 abstractC0349n0, ViewGroup viewGroup, View view, C1444a<String, String> c1444a, C0387h c0387h, ArrayList<View> arrayList, ArrayList<View> arrayList2, Object obj, Object obj2) {
        Object obj3;
        View view2;
        Rect rect;
        Fragment fragment = c0387h.f1566a;
        Fragment fragment2 = c0387h.f1569d;
        if (fragment != null) {
            fragment.m4214j1().setVisibility(0);
        }
        if (fragment == null || fragment2 == null) {
            return null;
        }
        boolean z = c0387h.f1567b;
        Object m3765t = c1444a.isEmpty() ? null : m3765t(abstractC0349n0, fragment, fragment2, z);
        C1444a<String, View> m3776i = m3776i(abstractC0349n0, c1444a, m3765t, c0387h);
        C1444a<String, View> m3777h = m3777h(abstractC0349n0, c1444a, m3765t, c0387h);
        if (c1444a.isEmpty()) {
            if (m3776i != null) {
                m3776i.clear();
            }
            if (m3777h != null) {
                m3777h.clear();
            }
            obj3 = null;
        } else {
            m3784a(arrayList, m3776i, c1444a.keySet());
            m3784a(arrayList2, m3777h, c1444a.values());
            obj3 = m3765t;
        }
        if (obj == null && obj2 == null && obj3 == null) {
            return null;
        }
        m3779f(fragment, fragment2, z, m3776i, true);
        if (obj3 != null) {
            arrayList2.add(view);
            abstractC0349n0.mo3897z(obj3, view, arrayList);
            m3759z(abstractC0349n0, obj3, obj2, m3776i, c0387h.f1570e, c0387h.f1571f);
            Rect rect2 = new Rect();
            View m3766s = m3766s(m3777h, c0387h, obj, z);
            if (m3766s != null) {
                abstractC0349n0.mo3902u(obj, rect2);
            }
            rect = rect2;
            view2 = m3766s;
        } else {
            view2 = null;
            rect = null;
        }
        ViewTreeObserver$OnPreDrawListenerC0801d1.m2889a(viewGroup, new RunnableC0384e(fragment, fragment2, z, m3777h, view2, abstractC0349n0, rect));
        return obj3;
    }

    /* renamed from: n */
    public static void m3771n(ViewGroup viewGroup, C0387h c0387h, View view, C1444a<String, String> c1444a, InterfaceC0386g interfaceC0386g) {
        Object obj;
        Fragment fragment = c0387h.f1566a;
        Fragment fragment2 = c0387h.f1569d;
        AbstractC0349n0 m3775j = m3775j(fragment2, fragment);
        if (m3775j == null) {
            return;
        }
        boolean z = c0387h.f1567b;
        boolean z2 = c0387h.f1570e;
        Object m3768q = m3768q(m3775j, fragment, z);
        Object m3767r = m3767r(m3775j, fragment2, z2);
        ArrayList arrayList = new ArrayList();
        ArrayList<View> arrayList2 = new ArrayList<>();
        Object m3773l = m3773l(m3775j, viewGroup, view, c1444a, c0387h, arrayList, arrayList2, m3768q, m3767r);
        if (m3768q == null && m3773l == null) {
            obj = m3767r;
            if (obj == null) {
                return;
            }
        } else {
            obj = m3767r;
        }
        ArrayList<View> m3774k = m3774k(m3775j, obj, fragment2, arrayList, view);
        Object obj2 = (m3774k == null || m3774k.isEmpty()) ? null : null;
        m3775j.mo3922a(m3768q, view);
        Object m3764u = m3764u(m3775j, m3768q, obj2, m3773l, fragment, c0387h.f1567b);
        if (fragment2 != null && m3774k != null && (m3774k.size() > 0 || arrayList.size() > 0)) {
            C0605h c0605h = new C0605h();
            interfaceC0386g.mo3757b(fragment2, c0605h);
            m3775j.mo3900w(fragment2, m3764u, c0605h, new RunnableC0382c(interfaceC0386g, fragment2, c0605h));
        }
        if (m3764u != null) {
            ArrayList<View> arrayList3 = new ArrayList<>();
            m3775j.mo3903t(m3764u, m3768q, arrayList3, obj2, m3774k, m3773l, arrayList2);
            m3760y(m3775j, viewGroup, fragment, view, arrayList2, m3768q, arrayList3, obj2, m3774k);
            m3775j.m3899x(viewGroup, arrayList2, c1444a);
            m3775j.mo3920c(viewGroup, m3764u);
            m3775j.m3904s(viewGroup, arrayList2, c1444a);
        }
    }

    /* renamed from: o */
    public static void m3770o(ViewGroup viewGroup, C0387h c0387h, View view, C1444a<String, String> c1444a, InterfaceC0386g interfaceC0386g) {
        Object obj;
        Fragment fragment = c0387h.f1566a;
        Fragment fragment2 = c0387h.f1569d;
        AbstractC0349n0 m3775j = m3775j(fragment2, fragment);
        if (m3775j == null) {
            return;
        }
        boolean z = c0387h.f1567b;
        boolean z2 = c0387h.f1570e;
        ArrayList<View> arrayList = new ArrayList<>();
        ArrayList<View> arrayList2 = new ArrayList<>();
        Object m3768q = m3768q(m3775j, fragment, z);
        Object m3767r = m3767r(m3775j, fragment2, z2);
        Object m3772m = m3772m(m3775j, viewGroup, view, c1444a, c0387h, arrayList2, arrayList, m3768q, m3767r);
        if (m3768q == null && m3772m == null) {
            obj = m3767r;
            if (obj == null) {
                return;
            }
        } else {
            obj = m3767r;
        }
        ArrayList<View> m3774k = m3774k(m3775j, obj, fragment2, arrayList2, view);
        ArrayList<View> m3774k2 = m3774k(m3775j, m3768q, fragment, arrayList, view);
        m3786A(m3774k2, 4);
        Object m3764u = m3764u(m3775j, m3768q, obj, m3772m, fragment, z);
        if (fragment2 != null && m3774k != null && (m3774k.size() > 0 || arrayList2.size() > 0)) {
            C0605h c0605h = new C0605h();
            interfaceC0386g.mo3757b(fragment2, c0605h);
            m3775j.mo3900w(fragment2, m3764u, c0605h, new RunnableC0380a(interfaceC0386g, fragment2, c0605h));
        }
        if (m3764u != null) {
            m3763v(m3775j, obj, fragment2, m3774k);
            ArrayList<String> m3908o = m3775j.m3908o(arrayList);
            m3775j.mo3903t(m3764u, m3768q, m3774k2, obj, m3774k, m3772m, arrayList);
            m3775j.mo3920c(viewGroup, m3764u);
            m3775j.m3898y(viewGroup, arrayList2, arrayList, m3908o, c1444a);
            m3786A(m3774k2, 0);
            m3775j.mo3924A(m3772m, arrayList2, arrayList);
        }
    }

    /* renamed from: p */
    public static C0387h m3769p(C0387h c0387h, SparseArray<C0387h> sparseArray, int i) {
        if (c0387h == null) {
            C0387h c0387h2 = new C0387h();
            sparseArray.put(i, c0387h2);
            return c0387h2;
        }
        return c0387h;
    }

    /* renamed from: q */
    public static Object m3768q(AbstractC0349n0 abstractC0349n0, Fragment fragment, boolean z) {
        if (fragment == null) {
            return null;
        }
        return abstractC0349n0.mo3916g(z ? fragment.m4274I() : fragment.m4189s());
    }

    /* renamed from: r */
    public static Object m3767r(AbstractC0349n0 abstractC0349n0, Fragment fragment, boolean z) {
        if (fragment == null) {
            return null;
        }
        return abstractC0349n0.mo3916g(z ? fragment.m4270K() : fragment.m4180v());
    }

    /* renamed from: s */
    public static View m3766s(C1444a<String, View> c1444a, C0387h c0387h, Object obj, boolean z) {
        ArrayList<String> arrayList;
        C0275a c0275a = c0387h.f1568c;
        if (obj == null || c1444a == null || (arrayList = c0275a.f1517p) == null || arrayList.isEmpty()) {
            return null;
        }
        return c1444a.get((z ? c0275a.f1517p : c0275a.f1518q).get(0));
    }

    /* renamed from: t */
    public static Object m3765t(AbstractC0349n0 abstractC0349n0, Fragment fragment, Fragment fragment2, boolean z) {
        if (fragment == null || fragment2 == null) {
            return null;
        }
        return abstractC0349n0.mo3923B(abstractC0349n0.mo3916g(z ? fragment2.m4266M() : fragment.m4268L()));
    }

    /* renamed from: u */
    public static Object m3764u(AbstractC0349n0 abstractC0349n0, Object obj, Object obj2, Object obj3, Fragment fragment, boolean z) {
        return (obj == null || obj2 == null || fragment == null) ? true : z ? fragment.m4207m() : fragment.m4210l() ? abstractC0349n0.mo3909n(obj2, obj, obj3) : abstractC0349n0.mo3910m(obj2, obj, obj3);
    }

    /* renamed from: v */
    public static void m3763v(AbstractC0349n0 abstractC0349n0, Object obj, Fragment fragment, ArrayList<View> arrayList) {
        if (fragment != null && obj != null && fragment.f1192o && fragment.f1154C && fragment.f1168Q) {
            fragment.m4187s1(true);
            abstractC0349n0.mo3905r(obj, fragment.m4258Q(), arrayList);
            ViewTreeObserver$OnPreDrawListenerC0801d1.m2889a(fragment.f1161J, new RunnableC0381b(arrayList));
        }
    }

    /* renamed from: w */
    public static AbstractC0349n0 m3762w() {
        try {
            return (AbstractC0349n0) Class.forName("androidx.transition.FragmentTransitionSupport").getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
        } catch (Exception unused) {
            return null;
        }
    }

    /* renamed from: x */
    public static void m3761x(C1444a<String, String> c1444a, C1444a<String, View> c1444a2) {
        for (int size = c1444a.size() - 1; size >= 0; size--) {
            if (!c1444a2.containsKey(c1444a.m1319l(size))) {
                c1444a.m1321j(size);
            }
        }
    }

    /* renamed from: y */
    public static void m3760y(AbstractC0349n0 abstractC0349n0, ViewGroup viewGroup, Fragment fragment, View view, ArrayList<View> arrayList, Object obj, ArrayList<View> arrayList2, Object obj2, ArrayList<View> arrayList3) {
        ViewTreeObserver$OnPreDrawListenerC0801d1.m2889a(viewGroup, new RunnableC0383d(obj, abstractC0349n0, view, fragment, arrayList, arrayList2, arrayList3, obj2));
    }

    /* renamed from: z */
    public static void m3759z(AbstractC0349n0 abstractC0349n0, Object obj, Object obj2, C1444a<String, View> c1444a, boolean z, C0275a c0275a) {
        ArrayList<String> arrayList = c0275a.f1517p;
        if (arrayList == null || arrayList.isEmpty()) {
            return;
        }
        View view = c1444a.get((z ? c0275a.f1518q : c0275a.f1517p).get(0));
        abstractC0349n0.mo3901v(obj, view);
        if (obj2 != null) {
            abstractC0349n0.mo3901v(obj2, view);
        }
    }
}