content: package androidx.fragment.app;
  
  import android.os.Bundle;
  import android.view.View;
  import android.view.ViewGroup;
  import androidx.core.view.ViewCompat;
  import androidx.lifecycle.Lifecycle;
  import java.lang.reflect.Modifier;
  import java.util.ArrayList;
  import mt.Log1F380D;
  
  /* compiled from: 0074 */
  public abstract class FragmentTransaction {
      static final int OP_ADD = 1;
      static final int OP_ATTACH = 7;
      static final int OP_DETACH = 6;
      static final int OP_HIDE = 4;
      static final int OP_NULL = 0;
      static final int OP_REMOVE = 3;
      static final int OP_REPLACE = 2;
      static final int OP_SET_MAX_LIFECYCLE = 10;
      static final int OP_SET_PRIMARY_NAV = 8;
      static final int OP_SHOW = 5;
      static final int OP_UNSET_PRIMARY_NAV = 9;
      public static final int TRANSIT_ENTER_MASK = 4096;
      public static final int TRANSIT_EXIT_MASK = 8192;
      public static final int TRANSIT_FRAGMENT_CLOSE = 8194;
      public static final int TRANSIT_FRAGMENT_FADE = 4099;
      public static final int TRANSIT_FRAGMENT_OPEN = 4097;
      public static final int TRANSIT_NONE = 0;
      public static final int TRANSIT_UNSET = -1;
      boolean mAddToBackStack;
      boolean mAllowAddToBackStack;
      int mBreadCrumbShortTitleRes;
      CharSequence mBreadCrumbShortTitleText;
      int mBreadCrumbTitleRes;
      CharSequence mBreadCrumbTitleText;
      private final ClassLoader mClassLoader;
      ArrayList<Runnable> mCommitRunnables;
      int mEnterAnim;
      int mExitAnim;
      private final FragmentFactory mFragmentFactory;
      String mName;
      ArrayList<Op> mOps;
      int mPopEnterAnim;
      int mPopExitAnim;
      boolean mReorderingAllowed;
      ArrayList<String> mSharedElementSourceNames;
      ArrayList<String> mSharedElementTargetNames;
      int mTransition;
  
      static final class Op {
          int mCmd;
          Lifecycle.State mCurrentMaxState;
          int mEnterAnim;
          int mExitAnim;
          Fragment mFragment;
          Lifecycle.State mOldMaxState;
          int mPopEnterAnim;
          int mPopExitAnim;
  
          Op() {
          }
  
          Op(int cmd, Fragment fragment) {
              this.mCmd = cmd;
              this.mFragment = fragment;
              this.mOldMaxState = Lifecycle.State.RESUMED;
              this.mCurrentMaxState = Lifecycle.State.RESUMED;
          }
  
          Op(int cmd, Fragment fragment, Lifecycle.State state) {
              this.mCmd = cmd;
              this.mFragment = fragment;
              this.mOldMaxState = fragment.mMaxState;
              this.mCurrentMaxState = state;
          }
      }
  
      @Deprecated
      public FragmentTransaction() {
          this.mOps = new ArrayList<>();
          this.mAllowAddToBackStack = true;
          this.mReorderingAllowed = false;
          this.mFragmentFactory = null;
          this.mClassLoader = null;
      }
  
      FragmentTransaction(FragmentFactory fragmentFactory, ClassLoader classLoader) {
          this.mOps = new ArrayList<>();
          this.mAllowAddToBackStack = true;
          this.mReorderingAllowed = false;
          this.mFragmentFactory = fragmentFactory;
          this.mClassLoader = classLoader;
      }
  
      private Fragment createFragment(Class<? extends Fragment> cls, Bundle args) {
          FragmentFactory fragmentFactory = this.mFragmentFactory;
          if (fragmentFactory != null) {
              ClassLoader classLoader = this.mClassLoader;
              if (classLoader != null) {
                  Fragment instantiate = fragmentFactory.instantiate(classLoader, cls.getName());
                  if (args != null) {
                      instantiate.setArguments(args);
                  }
                  return instantiate;
              }
              throw new IllegalStateException("The FragmentManager must be attached to itshost to create a Fragment");
          }
          throw new IllegalStateException("Creating a Fragment requires that this FragmentTransaction was built with FragmentManager.beginTransaction()");
      }
  
      public FragmentTransaction add(int containerViewId, Fragment fragment) {
          doAddOp(containerViewId, fragment, (String) null, 1);
          return this;
      }
  
      public FragmentTransaction add(int containerViewId, Fragment fragment, String tag) {
          doAddOp(containerViewId, fragment, tag, 1);
          return this;
      }
  
      public final FragmentTransaction add(int containerViewId, Class<? extends Fragment> cls, Bundle args) {
          return add(containerViewId, createFragment(cls, args));
      }
  
      public final FragmentTransaction add(int containerViewId, Class<? extends Fragment> cls, Bundle args, String tag) {
          return add(containerViewId, createFragment(cls, args), tag);
      }
  
      /* access modifiers changed from: package-private */
      public FragmentTransaction add(ViewGroup container, Fragment fragment, String tag) {
          fragment.mContainer = container;
          return add(container.getId(), fragment, tag);
      }
  
      public FragmentTransaction add(Fragment fragment, String tag) {
          doAddOp(0, fragment, tag, 1);
          return this;
      }
  
      public final FragmentTransaction add(Class<? extends Fragment> cls, Bundle args, String tag) {
          return add(createFragment(cls, args), tag);
      }
  
      /* access modifiers changed from: package-private */
      public void addOp(Op op) {
          this.mOps.add(op);
          op.mEnterAnim = this.mEnterAnim;
          op.mExitAnim = this.mExitAnim;
          op.mPopEnterAnim = this.mPopEnterAnim;
          op.mPopExitAnim = this.mPopExitAnim;
      }
  
      public FragmentTransaction addSharedElement(View sharedElement, String name) {
          if (FragmentTransition.supportsTransition()) {
              String transitionName = ViewCompat.getTransitionName(sharedElement);
              Log1F380D.a((Object) transitionName);
              if (transitionName != null) {
                  if (this.mSharedElementSourceNames == null) {
                      this.mSharedElementSourceNames = new ArrayList<>();
                      this.mSharedElementTargetNames = new ArrayList<>();
                  } else if (this.mSharedElementTargetNames.contains(name)) {
                      throw new IllegalArgumentException("A shared element with the target name '" + name + "' has already been added to the transaction.");
                  } else if (this.mSharedElementSourceNames.contains(transitionName)) {
                      throw new IllegalArgumentException("A shared element with the source name '" + transitionName + "' has already been added to the transaction.");
                  }
                  this.mSharedElementSourceNames.add(transitionName);
                  this.mSharedElementTargetNames.add(name);
              } else {
                  throw new IllegalArgumentException("Unique transitionNames are required for all sharedElements");
              }
          }
          return this;
      }
  
      public FragmentTransaction addToBackStack(String name) {
          if (this.mAllowAddToBackStack) {
              this.mAddToBackStack = true;
              this.mName = name;
              return this;
          }
          throw new IllegalStateException("This FragmentTransaction is not allowed to be added to the back stack.");
      }
  
      public FragmentTransaction attach(Fragment fragment) {
          addOp(new Op(7, fragment));
          return this;
      }
  
      public abstract int commit();
  
      public abstract int commitAllowingStateLoss();
  
      public abstract void commitNow();
  
      public abstract void commitNowAllowingStateLoss();
  
      public FragmentTransaction detach(Fragment fragment) {
          addOp(new Op(6, fragment));
          return this;
      }
  
      public FragmentTransaction disallowAddToBackStack() {
          if (!this.mAddToBackStack) {
              this.mAllowAddToBackStack = false;
              return this;
          }
          throw new IllegalStateException("This transaction is already being added to the back stack");
      }
  
      /* access modifiers changed from: package-private */
      public void doAddOp(int containerViewId, Fragment fragment, String tag, int opcmd) {
          Class<?> cls = fragment.getClass();
          int modifiers = cls.getModifiers();
          if (cls.isAnonymousClass() || !Modifier.isPublic(modifiers) || (cls.isMemberClass() && !Modifier.isStatic(modifiers))) {
              throw new IllegalStateException("Fragment " + cls.getCanonicalName() + " must be a public static class to be  properly recreated from instance state.");
          }
          if (tag != null) {
              if (fragment.mTag == null || tag.equals(fragment.mTag)) {
                  fragment.mTag = tag;
              } else {
                  throw new IllegalStateException("Can't change tag of fragment " + fragment + ": was " + fragment.mTag + " now " + tag);
              }
          }
          if (containerViewId != 0) {
              if (containerViewId == -1) {
                  throw new IllegalArgumentException("Can't add fragment " + fragment + " with tag " + tag + " to container view with no id");
              } else if (fragment.mFragmentId == 0 || fragment.mFragmentId == containerViewId) {
                  fragment.mFragmentId = containerViewId;
                  fragment.mContainerId = containerViewId;
              } else {
                  throw new IllegalStateException("Can't change container ID of fragment " + fragment + ": was " + fragment.mFragmentId + " now " + containerViewId);
              }
          }
          addOp(new Op(opcmd, fragment));
      }
  
      public FragmentTransaction hide(Fragment fragment) {
          addOp(new Op(4, fragment));
          return this;
      }
  
      public boolean isAddToBackStackAllowed() {
          return this.mAllowAddToBackStack;
      }
  
      public boolean isEmpty() {
          return this.mOps.isEmpty();
      }
  
      public FragmentTransaction remove(Fragment fragment) {
          addOp(new Op(3, fragment));
          return this;
      }
  
      public FragmentTransaction replace(int containerViewId, Fragment fragment) {
          return replace(containerViewId, fragment, (String) null);
      }
  
      public FragmentTransaction replace(int containerViewId, Fragment fragment, String tag) {
          if (containerViewId != 0) {
              doAddOp(containerViewId, fragment, tag, 2);
              return this;
          }
          throw new IllegalArgumentException("Must use non-zero containerViewId");
      }
  
      public final FragmentTransaction replace(int containerViewId, Class<? extends Fragment> cls, Bundle args) {
          return replace(containerViewId, cls, args, (String) null);
      }
  
      public final FragmentTransaction replace(int containerViewId, Class<? extends Fragment> cls, Bundle args, String tag) {
          return replace(containerViewId, createFragment(cls, args), tag);
      }
  
      public FragmentTransaction runOnCommit(Runnable runnable) {
          disallowAddToBackStack();
          if (this.mCommitRunnables == null) {
              this.mCommitRunnables = new ArrayList<>();
          }
          this.mCommitRunnables.add(runnable);
          return this;
      }
  
      @Deprecated
      public FragmentTransaction setAllowOptimization(boolean allowOptimization) {
          return setReorderingAllowed(allowOptimization);
      }
  
      @Deprecated
      public FragmentTransaction setBreadCrumbShortTitle(int res) {
          this.mBreadCrumbShortTitleRes = res;
          this.mBreadCrumbShortTitleText = null;
          return this;
      }
  
      @Deprecated
      public FragmentTransaction setBreadCrumbShortTitle(CharSequence text) {
          this.mBreadCrumbShortTitleRes = 0;
          this.mBreadCrumbShortTitleText = text;
          return this;
      }
  
      @Deprecated
      public FragmentTransaction setBreadCrumbTitle(int res) {
          this.mBreadCrumbTitleRes = res;
          this.mBreadCrumbTitleText = null;
          return this;
      }
  
      @Deprecated
      public FragmentTransaction setBreadCrumbTitle(CharSequence text) {
          this.mBreadCrumbTitleRes = 0;
          this.mBreadCrumbTitleText = text;
          return this;
      }
  
      public FragmentTransaction setCustomAnimations(int enter, int exit) {
          return setCustomAnimations(enter, exit, 0, 0);
      }
  
      public FragmentTransaction setCustomAnimations(int enter, int exit, int popEnter, int popExit) {
          this.mEnterAnim = enter;
          this.mExitAnim = exit;
          this.mPopEnterAnim = popEnter;
          this.mPopExitAnim = popExit;
          return this;
      }
  
      public FragmentTransaction setMaxLifecycle(Fragment fragment, Lifecycle.State state) {
          addOp(new Op(10, fragment, state));
          return this;
      }
  
      public FragmentTransaction setPrimaryNavigationFragment(Fragment fragment) {
          addOp(new Op(8, fragment));
          return this;
      }
  
      public FragmentTransaction setReorderingAllowed(boolean reorderingAllowed) {
          this.mReorderingAllowed = reorderingAllowed;
          return this;
      }
  
      public FragmentTransaction setTransition(int transition) {
          this.mTransition = transition;
          return this;
      }
  
      @Deprecated
      public FragmentTransaction setTransitionStyle(int styleRes) {
          return this;
      }
  
      public FragmentTransaction show(Fragment fragment) {
          addOp(new Op(5, fragment));
          return this;
      }
  }
  