package ῲ.Ԕ.K;

import android.graphics.Rect;
import android.os.Build;
import android.util.SparseArray;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import ῲ.Ԕ.K.AbstractC1558;
import ῲ.ᨨ.ᨨ.C1729;
import ῲ.ᨨ.ᨨ.ViewTreeObserver$OnPreDrawListenerC1728;
import ῲ.ᨨ.K.AbstractC1820;
import ῲ.㴹.AbstractC2278;
import ῲ.㴹.C2284;

/* renamed from: ῲ.Ԕ.K.㗽  reason: contains not printable characters */
/* compiled from: FragmentTransition */
public class C1538 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public static final AbstractC1523 f5624;

    /* renamed from: ῲ  reason: contains not printable characters */
    public static final AbstractC1523 f5625 = new C1517();

    /* renamed from: K  reason: contains not printable characters */
    public static final int[] f5626 = {0, 3, 0, 1, 5, 4, 7, 6, 9, 8, 10};

    /* renamed from: ῲ.Ԕ.K.㗽$K  reason: contains not printable characters */
    /* compiled from: FragmentTransition */
    public static class C1539 {

        /* renamed from: ʬ  reason: contains not printable characters */
        public C1535 f5627;

        /* renamed from: ඓ  reason: contains not printable characters */
        public boolean f5628;

        /* renamed from: ῲ  reason: contains not printable characters */
        public boolean f5629;

        /* renamed from: K  reason: contains not printable characters */
        public Fragment f5630;

        /* renamed from: 㴹  reason: contains not printable characters */
        public C1535 f5631;

        /* renamed from: 㸾  reason: contains not printable characters */
        public Fragment f5632;
    }

    static {
        AbstractC1523 r0;
        int i = Build.VERSION.SDK_INT;
        try {
            r0 = (AbstractC1523) Class.forName("ῲ.ᓆ.ඓ").getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
        } catch (Exception unused) {
            r0 = null;
        }
        f5624 = r0;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public static Object m3955(AbstractC1523 r0, Fragment fragment, boolean z) {
        Object obj;
        if (fragment == null) {
            return null;
        }
        if (z) {
            obj = fragment.getReturnTransition();
        } else {
            obj = fragment.getExitTransition();
        }
        return r0.m3884(obj);
    }

    /* JADX WARNING: Removed duplicated region for block: B:151:0x0419  */
    /* JADX WARNING: Removed duplicated region for block: B:160:0x0457 A[SYNTHETIC] */
    /* JADX WARNING: Removed duplicated region for block: B:85:0x0222 A[ADDED_TO_REGION] */
    /* renamed from: K  reason: contains not printable characters */
    public static void m3969(LayoutInflater$Factory2C1545 r39, ArrayList<C1535> arrayList, ArrayList<Boolean> arrayList2, int i, int i2, boolean z) {
        SparseArray sparseArray;
        int i3;
        int i4;
        int i5;
        int i6;
        Fragment fragment;
        Fragment fragment2;
        AbstractC1523 r6;
        ArrayList<View> arrayList3;
        Object obj;
        ArrayList<View> arrayList4;
        Fragment fragment3;
        Fragment fragment4;
        Object obj2;
        Object obj3;
        C2284 k;
        Object r1;
        Object obj4;
        Object obj5;
        Fragment fragment5;
        boolean z2;
        ArrayList<View> arrayList5;
        Fragment fragment6;
        Rect rect;
        Fragment fragment7;
        Fragment fragment8;
        AbstractC1523 r9;
        ArrayList<View> arrayList6;
        C2284 k2;
        Fragment fragment9;
        boolean z3;
        Object obj6;
        Object r12;
        C2284 k3;
        Object obj7;
        Rect rect2;
        View view;
        ArrayList<String> arrayList7;
        ArrayList<String> arrayList8;
        LayoutInflater$Factory2C1545 r0 = r39;
        ArrayList<C1535> arrayList9 = arrayList;
        ArrayList<Boolean> arrayList10 = arrayList2;
        int i7 = i2;
        boolean z4 = z;
        if (r0.f5658 >= 1) {
            SparseArray sparseArray2 = new SparseArray();
            for (int i8 = i; i8 < i7; i8++) {
                C1535 k4 = arrayList9.get(i8);
                if (!arrayList10.get(i8).booleanValue()) {
                    int size = k4.f5716.size();
                    for (int i9 = 0; i9 < size; i9++) {
                        m3968(k4, k4.f5716.get(i9), (SparseArray<C1539>) sparseArray2, false, z4);
                    }
                } else if (k4.f5610.f5651.m3857()) {
                    for (int size2 = k4.f5716.size() - 1; size2 >= 0; size2--) {
                        m3968(k4, k4.f5716.get(size2), (SparseArray<C1539>) sparseArray2, true, z4);
                    }
                }
            }
            if (sparseArray2.size() != 0) {
                View view2 = new View(r0.f5668.f5638);
                int size3 = sparseArray2.size();
                int i10 = 0;
                while (i10 < size3) {
                    int keyAt = sparseArray2.keyAt(i10);
                    C2284 k5 = new C2284();
                    int i11 = i7 - 1;
                    while (i11 >= i) {
                        C1535 k6 = arrayList9.get(i11);
                        if (k6.m3930(keyAt)) {
                            boolean booleanValue = arrayList10.get(i11).booleanValue();
                            ArrayList<String> arrayList11 = k6.f5708;
                            if (arrayList11 != null) {
                                if (booleanValue) {
                                    arrayList8 = k6.f5708;
                                    arrayList7 = k6.f5718;
                                } else {
                                    ArrayList<String> arrayList12 = k6.f5708;
                                    ArrayList<String> arrayList13 = k6.f5718;
                                    arrayList7 = arrayList12;
                                    arrayList8 = arrayList13;
                                }
                                int i12 = 0;
                                for (int size4 = arrayList11.size(); i12 < size4; size4 = size4) {
                                    String str = arrayList7.get(i12);
                                    String str2 = arrayList8.get(i12);
                                    String str3 = (String) k5.remove(str2);
                                    if (str3 != null) {
                                        k5.put(str, str3);
                                    } else {
                                        k5.put(str, str2);
                                    }
                                    i12++;
                                }
                            }
                        }
                        i11--;
                        arrayList9 = arrayList;
                        arrayList10 = arrayList2;
                    }
                    C1539 k7 = (C1539) sparseArray2.valueAt(i10);
                    if (z4) {
                        ViewGroup viewGroup = r0.f5651.m3857() ? (ViewGroup) r0.f5651.m3855(keyAt) : null;
                        if (viewGroup == null || (r9 = m3962((fragment8 = k7.f5632), (fragment7 = k7.f5630))) == null) {
                            sparseArray = sparseArray2;
                            i5 = i10;
                            i6 = size3;
                        } else {
                            boolean z5 = k7.f5629;
                            boolean z6 = k7.f5628;
                            ArrayList<View> arrayList14 = new ArrayList<>();
                            ArrayList<View> arrayList15 = new ArrayList<>();
                            sparseArray = sparseArray2;
                            Object r5 = m3959(r9, fragment7, z5);
                            Object r11 = m3955(r9, fragment8, z6);
                            Fragment fragment10 = k7.f5630;
                            i5 = i10;
                            Fragment fragment11 = k7.f5632;
                            i6 = size3;
                            if (fragment10 != null) {
                                fragment10.requireView().setVisibility(0);
                            }
                            if (fragment10 == null || fragment11 == null) {
                                arrayList6 = arrayList14;
                                fragment9 = fragment7;
                                z3 = z5;
                            } else {
                                boolean z7 = k7.f5629;
                                if (k5.isEmpty()) {
                                    z3 = z5;
                                    obj7 = null;
                                } else {
                                    obj7 = m3958(r9, fragment10, fragment11, z7);
                                    z3 = z5;
                                }
                                C2284<String, View> r10 = m3956(r9, k5, obj7, k7);
                                fragment9 = fragment7;
                                C2284<String, View> r62 = m3963(r9, k5, obj7, k7);
                                if (k5.isEmpty()) {
                                    if (r10 != null) {
                                        r10.clear();
                                    }
                                    if (r62 != null) {
                                        r62.clear();
                                    }
                                    obj6 = null;
                                } else {
                                    m3966(arrayList15, r10, k5.keySet());
                                    m3966(arrayList14, r62, k5.values());
                                    obj6 = obj7;
                                }
                                if (r5 == null && r11 == null && obj6 == null) {
                                    arrayList6 = arrayList14;
                                } else {
                                    k2 = k5;
                                    m3964(fragment10, fragment11, z7, r10, true);
                                    if (obj6 != null) {
                                        arrayList14.add(view2);
                                        r9.m3887(obj6, view2, arrayList15);
                                        arrayList6 = arrayList14;
                                        m3967(r9, obj6, r11, r10, k7.f5628, k7.f5631);
                                        Rect rect3 = new Rect();
                                        View r13 = m3957(r62, k7, r5, z7);
                                        if (r13 != null) {
                                            r9.m3892(r5, rect3);
                                        }
                                        view = r13;
                                        rect2 = rect3;
                                    } else {
                                        arrayList6 = arrayList14;
                                        view = null;
                                        rect2 = null;
                                    }
                                    ViewTreeObserver$OnPreDrawListenerC1728.m4435(viewGroup, new RunnableC1516(fragment10, fragment11, z7, r62, view, r9, rect2));
                                    if (!(r5 == null && obj6 == null && r11 == null)) {
                                        ArrayList<View> r02 = m3961(r9, r11, fragment8, arrayList15, view2);
                                        ArrayList<View> r63 = m3961(r9, r5, fragment9, arrayList6, view2);
                                        m3965(r63, 4);
                                        r12 = m3960(r9, r5, r11, obj6, fragment9, z3);
                                        if (r12 != null) {
                                            if (fragment8 != null && r11 != null && fragment8.mAdded && fragment8.mHidden && fragment8.mHiddenChanged) {
                                                fragment8.setHideReplaced(true);
                                                r9.m3894(r11, fragment8.getView(), r02);
                                                ViewTreeObserver$OnPreDrawListenerC1728.m4435(fragment8.mContainer, new RunnableC1514(r02));
                                            }
                                            ArrayList arrayList16 = new ArrayList();
                                            int i13 = 0;
                                            for (int size5 = arrayList6.size(); i13 < size5; size5 = size5) {
                                                View view3 = arrayList6.get(i13);
                                                arrayList16.add(C1729.m4443(view3));
                                                int i14 = Build.VERSION.SDK_INT;
                                                view3.setTransitionName(null);
                                                i13++;
                                            }
                                            r9.m3895(r12, r5, r63, r11, r02, obj6, arrayList6);
                                            r9.m3891(viewGroup, r12);
                                            int size6 = arrayList6.size();
                                            ArrayList arrayList17 = new ArrayList();
                                            int i15 = 0;
                                            while (i15 < size6) {
                                                View view4 = arrayList15.get(i15);
                                                String r112 = C1729.m4443(view4);
                                                arrayList17.add(r112);
                                                if (r112 == null) {
                                                    k3 = k2;
                                                } else {
                                                    int i16 = Build.VERSION.SDK_INT;
                                                    view4.setTransitionName(null);
                                                    k3 = k2;
                                                    String str4 = (String) k3.get(r112);
                                                    int i17 = 0;
                                                    while (true) {
                                                        if (i17 >= size6) {
                                                            break;
                                                        } else if (str4.equals(arrayList16.get(i17))) {
                                                            int i18 = Build.VERSION.SDK_INT;
                                                            arrayList6.get(i17).setTransitionName(r112);
                                                            break;
                                                        } else {
                                                            i17++;
                                                        }
                                                    }
                                                }
                                                i15++;
                                                k2 = k3;
                                            }
                                            ViewTreeObserver$OnPreDrawListenerC1728.m4435(viewGroup, new RunnableC1557(r9, size6, arrayList6, arrayList16, arrayList15, arrayList17));
                                            m3965(r63, 0);
                                            r9.m3888(obj6, arrayList15, arrayList6);
                                        }
                                    }
                                }
                            }
                            k2 = k5;
                            obj6 = null;
                            ArrayList<View> r022 = m3961(r9, r11, fragment8, arrayList15, view2);
                            ArrayList<View> r632 = m3961(r9, r5, fragment9, arrayList6, view2);
                            m3965(r632, 4);
                            r12 = m3960(r9, r5, r11, obj6, fragment9, z3);
                            if (r12 != null) {
                            }
                        }
                    } else {
                        sparseArray = sparseArray2;
                        i5 = i10;
                        i6 = size3;
                        ViewGroup viewGroup2 = r39.f5651.m3857() ? (ViewGroup) r39.f5651.m3855(keyAt) : null;
                        if (!(viewGroup2 == null || (r6 = m3962((fragment2 = k7.f5632), (fragment = k7.f5630))) == null)) {
                            boolean z8 = k7.f5629;
                            boolean z9 = k7.f5628;
                            Object r8 = m3959(r6, fragment, z8);
                            Object r122 = m3955(r6, fragment2, z9);
                            ArrayList<View> arrayList18 = new ArrayList<>();
                            ArrayList<View> arrayList19 = new ArrayList<>();
                            Fragment fragment12 = k7.f5630;
                            Fragment fragment13 = k7.f5632;
                            if (!(fragment12 == null || fragment13 == null)) {
                                boolean z10 = k7.f5629;
                                if (k5.isEmpty()) {
                                    obj4 = null;
                                } else {
                                    obj4 = m3958(r6, fragment12, fragment13, z10);
                                }
                                C2284<String, View> r2 = m3956(r6, k5, obj4, k7);
                                if (k5.isEmpty()) {
                                    obj5 = null;
                                } else {
                                    arrayList18.addAll(r2.values());
                                    obj5 = obj4;
                                }
                                if (!(r8 == null && r122 == null && obj5 == null)) {
                                    fragment4 = fragment;
                                    m3964(fragment12, fragment13, z10, r2, true);
                                    if (obj5 != null) {
                                        rect = new Rect();
                                        r6.m3887(obj5, view2, arrayList18);
                                        fragment6 = fragment12;
                                        arrayList5 = arrayList19;
                                        z2 = z10;
                                        fragment5 = fragment13;
                                        m3967(r6, obj5, r122, r2, k7.f5628, k7.f5631);
                                        if (r8 != null) {
                                            r6.m3892(r8, rect);
                                        }
                                    } else {
                                        fragment6 = fragment12;
                                        arrayList5 = arrayList19;
                                        z2 = z10;
                                        fragment5 = fragment13;
                                        rect = null;
                                    }
                                    fragment3 = fragment2;
                                    obj3 = r122;
                                    k = k5;
                                    arrayList4 = arrayList18;
                                    i4 = i5;
                                    obj = null;
                                    arrayList3 = arrayList5;
                                    i3 = i6;
                                    ViewTreeObserver$OnPreDrawListenerC1728.m4435(viewGroup2, new RunnableC1524(r6, k5, obj5, k7, arrayList5, view2, fragment6, fragment5, z2, arrayList4, r8, rect));
                                    obj2 = obj5;
                                    if (r8 != null && obj2 == null && obj3 == null) {
                                        i10 = i4 + 1;
                                        r0 = r39;
                                        arrayList9 = arrayList;
                                        arrayList10 = arrayList2;
                                        i7 = i2;
                                        z4 = z;
                                        size3 = i3;
                                        sparseArray2 = sparseArray;
                                    } else {
                                        ArrayList<View> r22 = m3961(r6, obj3, fragment3, arrayList4, view2);
                                        if (r22 != null && !r22.isEmpty()) {
                                            obj = obj3;
                                        }
                                        r6.m3893(r8, view2);
                                        r1 = m3960(r6, r8, obj, obj2, fragment4, k7.f5629);
                                        if (r1 == null) {
                                            ArrayList<View> arrayList20 = new ArrayList<>();
                                            r6.m3895(r1, r8, arrayList20, obj, r22, obj2, arrayList3);
                                            ViewTreeObserver$OnPreDrawListenerC1728.m4435(viewGroup2, new RunnableC1537(r8, r6, view2, fragment4, arrayList3, arrayList20, r22, obj));
                                            ViewTreeObserver$OnPreDrawListenerC1728.m4435(viewGroup2, new RunnableC1515(r6, arrayList3, k));
                                            r6.m3891(viewGroup2, r1);
                                            ViewTreeObserver$OnPreDrawListenerC1728.m4435(viewGroup2, new RunnableC1543(r6, arrayList3, k));
                                        }
                                        i10 = i4 + 1;
                                        r0 = r39;
                                        arrayList9 = arrayList;
                                        arrayList10 = arrayList2;
                                        i7 = i2;
                                        z4 = z;
                                        size3 = i3;
                                        sparseArray2 = sparseArray;
                                    }
                                }
                            }
                            fragment4 = fragment;
                            fragment3 = fragment2;
                            arrayList4 = arrayList18;
                            obj3 = r122;
                            k = k5;
                            i4 = i5;
                            i3 = i6;
                            obj = null;
                            arrayList3 = arrayList19;
                            obj2 = null;
                            if (r8 != null) {
                            }
                            ArrayList<View> r222 = m3961(r6, obj3, fragment3, arrayList4, view2);
                            obj = obj3;
                            r6.m3893(r8, view2);
                            r1 = m3960(r6, r8, obj, obj2, fragment4, k7.f5629);
                            if (r1 == null) {
                            }
                            i10 = i4 + 1;
                            r0 = r39;
                            arrayList9 = arrayList;
                            arrayList10 = arrayList2;
                            i7 = i2;
                            z4 = z;
                            size3 = i3;
                            sparseArray2 = sparseArray;
                        }
                    }
                    i4 = i5;
                    i3 = i6;
                    i10 = i4 + 1;
                    r0 = r39;
                    arrayList9 = arrayList;
                    arrayList10 = arrayList2;
                    i7 = i2;
                    z4 = z;
                    size3 = i3;
                    sparseArray2 = sparseArray;
                }
            }
        }
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public static C2284<String, View> m3956(AbstractC1523 r3, C2284<String, String> k, Object obj, C1539 k2) {
        AbstractC1820 r5;
        ArrayList<String> arrayList;
        if (k.isEmpty() || obj == null) {
            k.clear();
            return null;
        }
        Fragment fragment = k2.f5632;
        C2284<String, View> k3 = new C2284<>();
        r3.m3899((Map<String, View>) k3, fragment.requireView());
        C1535 k4 = k2.f5631;
        if (k2.f5628) {
            r5 = fragment.getEnterTransitionCallback();
            arrayList = k4.f5718;
        } else {
            r5 = fragment.getExitTransitionCallback();
            arrayList = k4.f5708;
        }
        AbstractC2278.m5939((Map) k3, (Collection<?>) arrayList);
        if (r5 == null) {
            AbstractC2278.m5939((Map) k, (Collection<?>) k3.keySet());
            return k3;
        }
        throw null;
    }

    /* renamed from: K  reason: contains not printable characters */
    public static AbstractC1523 m3962(Fragment fragment, Fragment fragment2) {
        ArrayList arrayList = new ArrayList();
        if (fragment != null) {
            Object exitTransition = fragment.getExitTransition();
            if (exitTransition != null) {
                arrayList.add(exitTransition);
            }
            Object returnTransition = fragment.getReturnTransition();
            if (returnTransition != null) {
                arrayList.add(returnTransition);
            }
            Object sharedElementReturnTransition = fragment.getSharedElementReturnTransition();
            if (sharedElementReturnTransition != null) {
                arrayList.add(sharedElementReturnTransition);
            }
        }
        if (fragment2 != null) {
            Object enterTransition = fragment2.getEnterTransition();
            if (enterTransition != null) {
                arrayList.add(enterTransition);
            }
            Object reenterTransition = fragment2.getReenterTransition();
            if (reenterTransition != null) {
                arrayList.add(reenterTransition);
            }
            Object sharedElementEnterTransition = fragment2.getSharedElementEnterTransition();
            if (sharedElementEnterTransition != null) {
                arrayList.add(sharedElementEnterTransition);
            }
        }
        if (arrayList.isEmpty()) {
            return null;
        }
        AbstractC1523 r2 = f5625;
        if (r2 != null && m3970(r2, arrayList)) {
            return f5625;
        }
        AbstractC1523 r22 = f5624;
        if (r22 != null && m3970(r22, arrayList)) {
            return f5624;
        }
        if (f5625 == null && f5624 == null) {
            return null;
        }
        throw new IllegalArgumentException("Invalid Transition types");
    }

    /* renamed from: K  reason: contains not printable characters */
    public static boolean m3970(AbstractC1523 r4, List<Object> list) {
        int size = list.size();
        for (int i = 0; i < size; i++) {
            if (!r4.m3900(list.get(i))) {
                return false;
            }
        }
        return true;
    }

    /* renamed from: K  reason: contains not printable characters */
    public static Object m3958(AbstractC1523 r0, Fragment fragment, Fragment fragment2, boolean z) {
        Object obj;
        if (fragment == null || fragment2 == null) {
            return null;
        }
        if (z) {
            obj = fragment2.getSharedElementReturnTransition();
        } else {
            obj = fragment.getSharedElementEnterTransition();
        }
        return r0.m3882(r0.m3884(obj));
    }

    /* renamed from: K  reason: contains not printable characters */
    public static Object m3959(AbstractC1523 r0, Fragment fragment, boolean z) {
        Object obj;
        if (fragment == null) {
            return null;
        }
        if (z) {
            obj = fragment.getReenterTransition();
        } else {
            obj = fragment.getEnterTransition();
        }
        return r0.m3884(obj);
    }

    /* renamed from: K  reason: contains not printable characters */
    public static void m3966(ArrayList<View> arrayList, C2284<String, View> k, Collection<String> collection) {
        for (int i = k.f7909 - 1; i >= 0; i--) {
            View r1 = k.m5973(i);
            if (collection.contains(C1729.m4443(r1))) {
                arrayList.add(r1);
            }
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public static C2284<String, View> m3963(AbstractC1523 r4, C2284<String, String> k, Object obj, C1539 k2) {
        AbstractC1820 r7;
        ArrayList<String> arrayList;
        Fragment fragment = k2.f5630;
        View view = fragment.getView();
        if (k.isEmpty() || obj == null || view == null) {
            k.clear();
            return null;
        }
        C2284<String, View> k3 = new C2284<>();
        r4.m3899((Map<String, View>) k3, view);
        C1535 k4 = k2.f5627;
        if (k2.f5629) {
            r7 = fragment.getExitTransitionCallback();
            arrayList = k4.f5708;
        } else {
            r7 = fragment.getEnterTransitionCallback();
            arrayList = k4.f5718;
        }
        if (arrayList != null) {
            AbstractC2278.m5939((Map) k3, (Collection<?>) arrayList);
            AbstractC2278.m5939((Map) k3, (Collection<?>) k.values());
        }
        if (r7 == null) {
            int i = k.f7909;
            while (true) {
                i--;
                if (i < 0) {
                    return k3;
                }
                if (!k3.containsKey(k.m5973(i))) {
                    k.m5982(i);
                }
            }
        } else {
            throw null;
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public static View m3957(C2284<String, View> k, C1539 k2, Object obj, boolean z) {
        ArrayList<String> arrayList;
        String str;
        C1535 k3 = k2.f5627;
        if (obj == null || k == null || (arrayList = k3.f5708) == null || arrayList.isEmpty()) {
            return null;
        }
        if (z) {
            str = k3.f5708.get(0);
        } else {
            str = k3.f5718.get(0);
        }
        return k.get(str);
    }

    /* renamed from: K  reason: contains not printable characters */
    public static void m3967(AbstractC1523 r1, Object obj, Object obj2, C2284<String, View> k, boolean z, C1535 k2) {
        String str;
        ArrayList<String> arrayList = k2.f5708;
        if (arrayList != null && !arrayList.isEmpty()) {
            if (z) {
                str = k2.f5718.get(0);
            } else {
                str = k2.f5708.get(0);
            }
            View view = k.get(str);
            r1.m3883(obj, view);
            if (obj2 != null) {
                r1.m3883(obj2, view);
            }
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public static void m3964(Fragment fragment, Fragment fragment2, boolean z, C2284<String, View> k, boolean z2) {
        AbstractC1820 r2;
        int i;
        if (z) {
            r2 = fragment2.getEnterTransitionCallback();
        } else {
            r2 = fragment.getEnterTransitionCallback();
        }
        if (r2 != null) {
            ArrayList arrayList = new ArrayList();
            ArrayList arrayList2 = new ArrayList();
            if (k == null) {
                i = 0;
            } else {
                i = k.f7909;
            }
            for (int i2 = 0; i2 < i; i2++) {
                arrayList2.add(k.m5972(i2));
                arrayList.add(k.m5973(i2));
            }
            if (z2) {
                throw null;
            }
            throw null;
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public static ArrayList<View> m3961(AbstractC1523 r1, Object obj, Fragment fragment, ArrayList<View> arrayList, View view) {
        if (obj == null) {
            return null;
        }
        ArrayList<View> arrayList2 = new ArrayList<>();
        View view2 = fragment.getView();
        if (view2 != null) {
            r1.m3898(arrayList2, view2);
        }
        if (arrayList != null) {
            arrayList2.removeAll(arrayList);
        }
        if (arrayList2.isEmpty()) {
            return arrayList2;
        }
        arrayList2.add(view);
        r1.m3896(obj, arrayList2);
        return arrayList2;
    }

    /* renamed from: K  reason: contains not printable characters */
    public static void m3965(ArrayList<View> arrayList, int i) {
        if (arrayList != null) {
            for (int size = arrayList.size() - 1; size >= 0; size--) {
                arrayList.get(size).setVisibility(i);
            }
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public static Object m3960(AbstractC1523 r0, Object obj, Object obj2, Object obj3, Fragment fragment, boolean z) {
        boolean z2;
        if (obj == null || obj2 == null || fragment == null) {
            z2 = true;
        } else {
            z2 = z ? fragment.getAllowReturnTransitionOverlap() : fragment.getAllowEnterTransitionOverlap();
        }
        if (z2) {
            return r0.m3885(obj2, obj, obj3);
        }
        return r0.m3889(obj2, obj, obj3);
    }

    /* JADX WARNING: Code restructure failed: missing block: B:28:0x0038, code lost:
        if (r6.mAdded != false) goto L_0x008a;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:54:0x0076, code lost:
        r12 = true;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:62:0x0088, code lost:
        if (r6.mHidden == false) goto L_0x008a;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:63:0x008a, code lost:
        r12 = true;
     */
    /* JADX WARNING: Removed duplicated region for block: B:100:? A[ADDED_TO_REGION, RETURN, SYNTHETIC] */
    /* JADX WARNING: Removed duplicated region for block: B:69:0x0099  */
    /* JADX WARNING: Removed duplicated region for block: B:91:0x00dc  */
    /* JADX WARNING: Removed duplicated region for block: B:94:0x00ec A[ADDED_TO_REGION] */
    /* renamed from: K  reason: contains not printable characters */
    public static void m3968(C1535 k, AbstractC1558.C1559 k2, SparseArray<C1539> sparseArray, boolean z, boolean z2) {
        int i;
        boolean z3;
        boolean z4;
        boolean z5;
        C1539 k3;
        LayoutInflater$Factory2C1545 r1;
        boolean z6;
        Fragment fragment = k2.f5726;
        if (fragment != null && (i = fragment.mContainerId) != 0) {
            int i2 = z ? f5626[k2.f5728] : k2.f5728;
            boolean z7 = false;
            if (i2 != 1) {
                if (i2 != 3) {
                    if (i2 != 4) {
                        if (i2 != 5) {
                            if (i2 != 6) {
                                if (i2 != 7) {
                                    z3 = false;
                                    z6 = false;
                                    z7 = z6;
                                    z5 = false;
                                    z4 = false;
                                    C1539 k4 = sparseArray.get(i);
                                    if (z3) {
                                        if (k4 == null) {
                                            C1539 k5 = new C1539();
                                            sparseArray.put(i, k5);
                                            k4 = k5;
                                        }
                                        k4.f5630 = fragment;
                                        k4.f5629 = z;
                                        k4.f5627 = k;
                                    }
                                    k3 = k4;
                                    if (!z2 && z7) {
                                        if (k3 != null && k3.f5632 == fragment) {
                                            k3.f5632 = null;
                                        }
                                        r1 = k.f5610;
                                        if (fragment.mState < 1 && r1.f5658 >= 1 && !k.f5709) {
                                            r1.m4056(fragment);
                                            r1.m4033(fragment, 1, 0, 0, false);
                                        }
                                    }
                                    if (z4 && (k3 == null || k3.f5632 == null)) {
                                        if (k3 == null) {
                                            k3 = new C1539();
                                            sparseArray.put(i, k3);
                                        }
                                        k3.f5632 = fragment;
                                        k3.f5628 = z;
                                        k3.f5631 = k;
                                    }
                                    if (z2 && z5 && k3 != null && k3.f5630 == fragment) {
                                        k3.f5630 = null;
                                        return;
                                    }
                                    return;
                                }
                            }
                        } else if (z2) {
                            if (fragment.mHiddenChanged) {
                                if (!fragment.mHidden) {
                                }
                            }
                            z3 = false;
                            z6 = true;
                            z7 = z6;
                            z5 = false;
                            z4 = false;
                            C1539 k42 = sparseArray.get(i);
                            if (z3) {
                            }
                            k3 = k42;
                            k3.f5632 = null;
                            r1 = k.f5610;
                            r1.m4056(fragment);
                            r1.m4033(fragment, 1, 0, 0, false);
                            if (k3 == null) {
                            }
                            k3.f5632 = fragment;
                            k3.f5628 = z;
                            k3.f5631 = k;
                            if (z2) {
                                return;
                            }
                            return;
                        } else {
                            z3 = fragment.mHidden;
                            z6 = true;
                            z7 = z6;
                            z5 = false;
                            z4 = false;
                            C1539 k422 = sparseArray.get(i);
                            if (z3) {
                            }
                            k3 = k422;
                            k3.f5632 = null;
                            r1 = k.f5610;
                            r1.m4056(fragment);
                            r1.m4033(fragment, 1, 0, 0, false);
                            if (k3 == null) {
                            }
                            k3.f5632 = fragment;
                            k3.f5628 = z;
                            k3.f5631 = k;
                            if (z2) {
                            }
                        }
                    } else if (!z2) {
                        boolean z8 = false;
                        z4 = z8;
                        z3 = false;
                        z5 = true;
                        C1539 k4222 = sparseArray.get(i);
                        if (z3) {
                        }
                        k3 = k4222;
                        k3.f5632 = null;
                        r1 = k.f5610;
                        r1.m4056(fragment);
                        r1.m4033(fragment, 1, 0, 0, false);
                        if (k3 == null) {
                        }
                        k3.f5632 = fragment;
                        k3.f5628 = z;
                        k3.f5631 = k;
                        if (z2) {
                        }
                    } else {
                        boolean z82 = false;
                        z4 = z82;
                        z3 = false;
                        z5 = true;
                        C1539 k42222 = sparseArray.get(i);
                        if (z3) {
                        }
                        k3 = k42222;
                        k3.f5632 = null;
                        r1 = k.f5610;
                        r1.m4056(fragment);
                        r1.m4033(fragment, 1, 0, 0, false);
                        if (k3 == null) {
                        }
                        k3.f5632 = fragment;
                        k3.f5628 = z;
                        k3.f5631 = k;
                        if (z2) {
                        }
                    }
                }
                if (!z2) {
                    boolean z822 = false;
                    z4 = z822;
                    z3 = false;
                    z5 = true;
                    C1539 k422222 = sparseArray.get(i);
                    if (z3) {
                    }
                    k3 = k422222;
                    k3.f5632 = null;
                    r1 = k.f5610;
                    r1.m4056(fragment);
                    r1.m4033(fragment, 1, 0, 0, false);
                    if (k3 == null) {
                    }
                    k3.f5632 = fragment;
                    k3.f5628 = z;
                    k3.f5631 = k;
                    if (z2) {
                    }
                } else {
                    boolean z8222 = false;
                    z4 = z8222;
                    z3 = false;
                    z5 = true;
                    C1539 k4222222 = sparseArray.get(i);
                    if (z3) {
                    }
                    k3 = k4222222;
                    k3.f5632 = null;
                    r1 = k.f5610;
                    r1.m4056(fragment);
                    r1.m4033(fragment, 1, 0, 0, false);
                    if (k3 == null) {
                    }
                    k3.f5632 = fragment;
                    k3.f5628 = z;
                    k3.f5631 = k;
                    if (z2) {
                    }
                }
            }
            if (z2) {
                z3 = fragment.mIsNewlyAdded;
                z6 = true;
                z7 = z6;
                z5 = false;
                z4 = false;
                C1539 k42222222 = sparseArray.get(i);
                if (z3) {
                }
                k3 = k42222222;
                k3.f5632 = null;
                r1 = k.f5610;
                r1.m4056(fragment);
                r1.m4033(fragment, 1, 0, 0, false);
                if (k3 == null) {
                }
                k3.f5632 = fragment;
                k3.f5628 = z;
                k3.f5631 = k;
                if (z2) {
                }
            } else {
                if (!fragment.mAdded) {
                }
                z3 = false;
                z6 = true;
                z7 = z6;
                z5 = false;
                z4 = false;
                C1539 k422222222 = sparseArray.get(i);
                if (z3) {
                }
                k3 = k422222222;
                k3.f5632 = null;
                r1 = k.f5610;
                r1.m4056(fragment);
                r1.m4033(fragment, 1, 0, 0, false);
                if (k3 == null) {
                }
                k3.f5632 = fragment;
                k3.f5628 = z;
                k3.f5631 = k;
                if (z2) {
                }
            }
        }
    }
}
