package androidx.fragment.app;

import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.content.Context;
import android.content.res.Resources;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import com.debridstream.tv.R;

/* JADX INFO: renamed from: androidx.fragment.app.j, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1053j extends AbstractC1054k {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final boolean f11638c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public boolean f11639d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public M f11640e;

    public C1053j(D0 d02, B1.d dVar, boolean z6) {
        super(d02, dVar);
        this.f11638c = z6;
    }

    /* JADX WARN: Removed duplicated region for block: B:74:0x00f3 A[Catch: RuntimeException -> 0x00f9, TRY_LEAVE, TryCatch #2 {RuntimeException -> 0x00f9, blocks: (B:72:0x00ed, B:74:0x00f3), top: B:85:0x00ed }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final M c(Context context) {
        Animation animationLoadAnimation;
        M m6;
        Animator animatorLoadAnimator;
        if (this.f11639d) {
            return this.f11640e;
        }
        D0 d02 = this.f11649a;
        boolean z6 = d02.f11510a == 2;
        G g6 = d02.f11512c;
        int nextTransition = g6.getNextTransition();
        int popEnterAnim = this.f11638c ? z6 ? g6.getPopEnterAnim() : g6.getPopExitAnim() : z6 ? g6.getEnterAnim() : g6.getExitAnim();
        g6.setAnimations(0, 0, 0, 0);
        ViewGroup viewGroup = g6.mContainer;
        M m7 = null;
        if (viewGroup != null && viewGroup.getTag(R.id.visible_removing_fragment_view_tag) != null) {
            g6.mContainer.setTag(R.id.visible_removing_fragment_view_tag, null);
        }
        ViewGroup viewGroup2 = g6.mContainer;
        if (viewGroup2 == null || viewGroup2.getLayoutTransition() == null) {
            Animation animationOnCreateAnimation = g6.onCreateAnimation(nextTransition, z6, popEnterAnim);
            if (animationOnCreateAnimation != null) {
                m7 = new M(animationOnCreateAnimation);
            } else {
                Animator animatorOnCreateAnimator = g6.onCreateAnimator(nextTransition, z6, popEnterAnim);
                if (animatorOnCreateAnimator != null) {
                    m7 = new M(animatorOnCreateAnimator);
                } else {
                    if (popEnterAnim == 0 && nextTransition != 0) {
                        popEnterAnim = nextTransition != 4097 ? nextTransition != 8194 ? nextTransition != 8197 ? nextTransition != 4099 ? nextTransition != 4100 ? -1 : z6 ? W.d.D(context, android.R.attr.activityOpenEnterAnimation) : W.d.D(context, android.R.attr.activityOpenExitAnimation) : z6 ? R.animator.fragment_fade_enter : R.animator.fragment_fade_exit : z6 ? W.d.D(context, android.R.attr.activityCloseEnterAnimation) : W.d.D(context, android.R.attr.activityCloseExitAnimation) : z6 ? R.animator.fragment_close_enter : R.animator.fragment_close_exit : z6 ? R.animator.fragment_open_enter : R.animator.fragment_open_exit;
                    }
                    if (popEnterAnim != 0) {
                        boolean zEquals = "anim".equals(context.getResources().getResourceTypeName(popEnterAnim));
                        if (zEquals) {
                            try {
                                animationLoadAnimation = AnimationUtils.loadAnimation(context, popEnterAnim);
                            } catch (Resources.NotFoundException e6) {
                                throw e6;
                            } catch (RuntimeException unused) {
                                try {
                                    animatorLoadAnimator = AnimatorInflater.loadAnimator(context, popEnterAnim);
                                    if (animatorLoadAnimator != null) {
                                    }
                                } catch (RuntimeException e7) {
                                    if (zEquals) {
                                        throw e7;
                                    }
                                    Animation animationLoadAnimation2 = AnimationUtils.loadAnimation(context, popEnterAnim);
                                    if (animationLoadAnimation2 != null) {
                                        m7 = new M(animationLoadAnimation2);
                                    }
                                }
                            }
                            if (animationLoadAnimation != null) {
                                m6 = new M(animationLoadAnimation);
                                m7 = m6;
                            }
                        } else {
                            animatorLoadAnimator = AnimatorInflater.loadAnimator(context, popEnterAnim);
                            if (animatorLoadAnimator != null) {
                                m6 = new M(animatorLoadAnimator);
                                m7 = m6;
                            }
                        }
                    }
                }
            }
        }
        this.f11640e = m7;
        this.f11639d = true;
        return m7;
    }
}
