package androidx.fragment.app;

import D.C0036g;
import P.InterfaceC0166j;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Looper;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import androidx.lifecycle.EnumC0308o;
import androidx.lifecycle.InterfaceC0313u;
import com.riyaz.zvytour.R;
import d.C0527u;
import d.InterfaceC0528v;
import f.AbstractC0585h;
import f.C0584g;
import f.InterfaceC0586i;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import p0.AbstractC0928a;
import r4.AbstractC0983h;

/* JADX INFO: loaded from: classes.dex */
public abstract class h0 {

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    public final L1.A f4263A;

    /* JADX INFO: renamed from: B, reason: collision with root package name */
    public C0584g f4264B;

    /* JADX INFO: renamed from: C, reason: collision with root package name */
    public C0584g f4265C;

    /* JADX INFO: renamed from: D, reason: collision with root package name */
    public C0584g f4266D;

    /* JADX INFO: renamed from: E, reason: collision with root package name */
    public ArrayDeque f4267E;

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

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

    /* JADX INFO: renamed from: H, reason: collision with root package name */
    public boolean f4270H;
    public boolean I;
    public boolean J;
    public ArrayList K;

    /* JADX INFO: renamed from: L, reason: collision with root package name */
    public ArrayList f4271L;

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

    /* JADX INFO: renamed from: N, reason: collision with root package name */
    public l0 f4273N;

    /* JADX INFO: renamed from: O, reason: collision with root package name */
    public final r f4274O;

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

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

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public C0527u f4281g;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final ArrayList f4286m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public final O f4287n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public final CopyOnWriteArrayList f4288o;
    public final W p;
    public final W q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final W f4289r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final W f4290s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public final Z f4291t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public int f4292u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public T f4293v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public Q f4294w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public I f4295x;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public I f4296y;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public final C0263a0 f4297z;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final ArrayList f4275a = new ArrayList();

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final q0 f4277c = new q0();

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public ArrayList f4278d = new ArrayList();

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final V f4280f = new V(this);

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public C0262a f4282h = null;
    public final Y i = new Y(this);

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final AtomicInteger f4283j = new AtomicInteger();

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public final Map f4284k = Collections.synchronizedMap(new HashMap());

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public final Map f4285l = Collections.synchronizedMap(new HashMap());

    /* JADX WARN: Type inference failed for: r0v15, types: [androidx.fragment.app.W] */
    /* JADX WARN: Type inference failed for: r0v16, types: [androidx.fragment.app.W] */
    /* JADX WARN: Type inference failed for: r0v17, types: [androidx.fragment.app.W] */
    /* JADX WARN: Type inference failed for: r0v18, types: [androidx.fragment.app.W] */
    public h0() {
        Collections.synchronizedMap(new HashMap());
        this.f4286m = new ArrayList();
        this.f4287n = new O(this);
        this.f4288o = new CopyOnWriteArrayList();
        final int i = 0;
        this.p = new O.a(this) { // from class: androidx.fragment.app.W

            /* JADX INFO: renamed from: b, reason: collision with root package name */
            public final /* synthetic */ h0 f4203b;

            {
                this.f4203b = this;
            }

            @Override // O.a
            public final void accept(Object obj) {
                switch (i) {
                    case 0:
                        Configuration configuration = (Configuration) obj;
                        h0 h0Var = this.f4203b;
                        if (h0Var.L()) {
                            h0Var.i(false, configuration);
                        }
                        break;
                    case 1:
                        Integer num = (Integer) obj;
                        h0 h0Var2 = this.f4203b;
                        if (h0Var2.L() && num.intValue() == 80) {
                            h0Var2.m(false);
                            break;
                        }
                        break;
                    case 2:
                        C0036g c0036g = (C0036g) obj;
                        h0 h0Var3 = this.f4203b;
                        if (h0Var3.L()) {
                            h0Var3.n(c0036g.f361a, false);
                        }
                        break;
                    default:
                        D.Z z5 = (D.Z) obj;
                        h0 h0Var4 = this.f4203b;
                        if (h0Var4.L()) {
                            h0Var4.s(z5.f354a, false);
                        }
                        break;
                }
            }
        };
        final int i5 = 1;
        this.q = new O.a(this) { // from class: androidx.fragment.app.W

            /* JADX INFO: renamed from: b, reason: collision with root package name */
            public final /* synthetic */ h0 f4203b;

            {
                this.f4203b = this;
            }

            @Override // O.a
            public final void accept(Object obj) {
                switch (i5) {
                    case 0:
                        Configuration configuration = (Configuration) obj;
                        h0 h0Var = this.f4203b;
                        if (h0Var.L()) {
                            h0Var.i(false, configuration);
                        }
                        break;
                    case 1:
                        Integer num = (Integer) obj;
                        h0 h0Var2 = this.f4203b;
                        if (h0Var2.L() && num.intValue() == 80) {
                            h0Var2.m(false);
                            break;
                        }
                        break;
                    case 2:
                        C0036g c0036g = (C0036g) obj;
                        h0 h0Var3 = this.f4203b;
                        if (h0Var3.L()) {
                            h0Var3.n(c0036g.f361a, false);
                        }
                        break;
                    default:
                        D.Z z5 = (D.Z) obj;
                        h0 h0Var4 = this.f4203b;
                        if (h0Var4.L()) {
                            h0Var4.s(z5.f354a, false);
                        }
                        break;
                }
            }
        };
        final int i6 = 2;
        this.f4289r = new O.a(this) { // from class: androidx.fragment.app.W

            /* JADX INFO: renamed from: b, reason: collision with root package name */
            public final /* synthetic */ h0 f4203b;

            {
                this.f4203b = this;
            }

            @Override // O.a
            public final void accept(Object obj) {
                switch (i6) {
                    case 0:
                        Configuration configuration = (Configuration) obj;
                        h0 h0Var = this.f4203b;
                        if (h0Var.L()) {
                            h0Var.i(false, configuration);
                        }
                        break;
                    case 1:
                        Integer num = (Integer) obj;
                        h0 h0Var2 = this.f4203b;
                        if (h0Var2.L() && num.intValue() == 80) {
                            h0Var2.m(false);
                            break;
                        }
                        break;
                    case 2:
                        C0036g c0036g = (C0036g) obj;
                        h0 h0Var3 = this.f4203b;
                        if (h0Var3.L()) {
                            h0Var3.n(c0036g.f361a, false);
                        }
                        break;
                    default:
                        D.Z z5 = (D.Z) obj;
                        h0 h0Var4 = this.f4203b;
                        if (h0Var4.L()) {
                            h0Var4.s(z5.f354a, false);
                        }
                        break;
                }
            }
        };
        final int i7 = 3;
        this.f4290s = new O.a(this) { // from class: androidx.fragment.app.W

            /* JADX INFO: renamed from: b, reason: collision with root package name */
            public final /* synthetic */ h0 f4203b;

            {
                this.f4203b = this;
            }

            @Override // O.a
            public final void accept(Object obj) {
                switch (i7) {
                    case 0:
                        Configuration configuration = (Configuration) obj;
                        h0 h0Var = this.f4203b;
                        if (h0Var.L()) {
                            h0Var.i(false, configuration);
                        }
                        break;
                    case 1:
                        Integer num = (Integer) obj;
                        h0 h0Var2 = this.f4203b;
                        if (h0Var2.L() && num.intValue() == 80) {
                            h0Var2.m(false);
                            break;
                        }
                        break;
                    case 2:
                        C0036g c0036g = (C0036g) obj;
                        h0 h0Var3 = this.f4203b;
                        if (h0Var3.L()) {
                            h0Var3.n(c0036g.f361a, false);
                        }
                        break;
                    default:
                        D.Z z5 = (D.Z) obj;
                        h0 h0Var4 = this.f4203b;
                        if (h0Var4.L()) {
                            h0Var4.s(z5.f354a, false);
                        }
                        break;
                }
            }
        };
        this.f4291t = new Z(this);
        this.f4292u = -1;
        this.f4297z = new C0263a0(this);
        this.f4263A = new L1.A(21);
        this.f4267E = new ArrayDeque();
        this.f4274O = new r(2, this);
    }

    public static HashSet E(C0262a c0262a) {
        HashSet hashSet = new HashSet();
        for (int i = 0; i < c0262a.f4208a.size(); i++) {
            I i5 = ((r0) c0262a.f4208a.get(i)).f4366b;
            if (i5 != null && c0262a.f4214g) {
                hashSet.add(i5);
            }
        }
        return hashSet;
    }

    public static boolean J(int i) {
        return Log.isLoggable("FragmentManager", i);
    }

    public static boolean K(I i) {
        if (i.mHasMenu && i.mMenuVisible) {
            return true;
        }
        boolean zK = false;
        for (I i5 : i.mChildFragmentManager.f4277c.e()) {
            if (i5 != null) {
                zK = K(i5);
            }
            if (zK) {
                return true;
            }
        }
        return false;
    }

    public static boolean M(I i) {
        if (i == null) {
            return true;
        }
        h0 h0Var = i.mFragmentManager;
        return i.equals(h0Var.f4296y) && M(h0Var.f4295x);
    }

    public static void b0(I i) {
        if (J(2)) {
            Log.v("FragmentManager", "show: " + i);
        }
        if (i.mHidden) {
            i.mHidden = false;
            i.mHiddenChanged = !i.mHiddenChanged;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:110:0x0219 A[PHI: r14
      0x0219: PHI (r14v9 int) = (r14v8 int), (r14v10 int) binds: [B:103:0x0209, B:108:0x0215] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:66:0x016e  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public final void A(java.util.ArrayList r27, java.util.ArrayList r28, int r29, int r30) {
        /*
            Method dump skipped, instruction units count: 1286
            To view this dump change 'Code comments level' option to 'DEBUG'
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.fragment.app.h0.A(java.util.ArrayList, java.util.ArrayList, int, int):void");
    }

    public final I B(int i) {
        q0 q0Var = this.f4277c;
        ArrayList arrayList = q0Var.f4359a;
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            I i5 = (I) arrayList.get(size);
            if (i5 != null && i5.mFragmentId == i) {
                return i5;
            }
        }
        for (p0 p0Var : q0Var.f4360b.values()) {
            if (p0Var != null) {
                I i6 = p0Var.f4351c;
                if (i6.mFragmentId == i) {
                    return i6;
                }
            }
        }
        return null;
    }

    public final I C(String str) {
        q0 q0Var = this.f4277c;
        ArrayList arrayList = q0Var.f4359a;
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            I i = (I) arrayList.get(size);
            if (i != null && str.equals(i.mTag)) {
                return i;
            }
        }
        for (p0 p0Var : q0Var.f4360b.values()) {
            if (p0Var != null) {
                I i5 = p0Var.f4351c;
                if (str.equals(i5.mTag)) {
                    return i5;
                }
            }
        }
        return null;
    }

    public final void D() {
        for (C0285q c0285q : e()) {
            if (c0285q.f4358e) {
                if (J(2)) {
                    Log.v("FragmentManager", "SpecialEffectsController: Forcing postponed operations");
                }
                c0285q.f4358e = false;
                c0285q.e();
            }
        }
    }

    public final ViewGroup F(I i) {
        ViewGroup viewGroup = i.mContainer;
        if (viewGroup != null) {
            return viewGroup;
        }
        if (i.mContainerId <= 0 || !this.f4294w.c()) {
            return null;
        }
        View viewB = this.f4294w.b(i.mContainerId);
        if (viewB instanceof ViewGroup) {
            return (ViewGroup) viewB;
        }
        return null;
    }

    public final C0263a0 G() {
        I i = this.f4295x;
        return i != null ? i.mFragmentManager.G() : this.f4297z;
    }

    public final L1.A H() {
        I i = this.f4295x;
        return i != null ? i.mFragmentManager.H() : this.f4263A;
    }

    public final void I(I i) {
        if (J(2)) {
            Log.v("FragmentManager", "hide: " + i);
        }
        if (i.mHidden) {
            return;
        }
        i.mHidden = true;
        i.mHiddenChanged = true ^ i.mHiddenChanged;
        a0(i);
    }

    public final boolean L() {
        I i = this.f4295x;
        if (i == null) {
            return true;
        }
        return i.isAdded() && this.f4295x.getParentFragmentManager().L();
    }

    public final void N(int i, boolean z5) {
        HashMap map;
        T t4;
        if (this.f4293v == null && i != -1) {
            throw new IllegalStateException("No activity");
        }
        if (z5 || i != this.f4292u) {
            this.f4292u = i;
            q0 q0Var = this.f4277c;
            Iterator it = q0Var.f4359a.iterator();
            while (true) {
                boolean zHasNext = it.hasNext();
                map = q0Var.f4360b;
                if (!zHasNext) {
                    break;
                }
                p0 p0Var = (p0) map.get(((I) it.next()).mWho);
                if (p0Var != null) {
                    p0Var.k();
                }
            }
            for (p0 p0Var2 : map.values()) {
                if (p0Var2 != null) {
                    p0Var2.k();
                    I i5 = p0Var2.f4351c;
                    if (i5.mRemoving && !i5.isInBackStack()) {
                        if (i5.mBeingSaved && !q0Var.f4361c.containsKey(i5.mWho)) {
                            q0Var.i(p0Var2.n(), i5.mWho);
                        }
                        q0Var.h(p0Var2);
                    }
                }
            }
            for (p0 p0Var3 : q0Var.d()) {
                I i6 = p0Var3.f4351c;
                if (i6.mDeferStart) {
                    if (this.f4276b) {
                        this.J = true;
                    } else {
                        i6.mDeferStart = false;
                        p0Var3.k();
                    }
                }
            }
            if (this.f4268F && (t4 = this.f4293v) != null && this.f4292u == 7) {
                ((M) t4).f4186o.invalidateMenu();
                this.f4268F = false;
            }
        }
    }

    public final void O() {
        if (this.f4293v == null) {
            return;
        }
        this.f4269G = false;
        this.f4270H = false;
        this.f4273N.i = false;
        for (I i : this.f4277c.f()) {
            if (i != null) {
                i.noteStateNotSaved();
            }
        }
    }

    public final boolean P() {
        return Q(-1, 0);
    }

    public final boolean Q(int i, int i5) {
        z(false);
        y(true);
        I i6 = this.f4296y;
        if (i6 != null && i < 0 && i6.getChildFragmentManager().P()) {
            return true;
        }
        boolean zR = R(this.K, this.f4271L, i, i5);
        if (zR) {
            this.f4276b = true;
            try {
                T(this.K, this.f4271L);
            } finally {
                d();
            }
        }
        d0();
        boolean z5 = this.J;
        q0 q0Var = this.f4277c;
        if (z5) {
            this.J = false;
            for (p0 p0Var : q0Var.d()) {
                I i7 = p0Var.f4351c;
                if (i7.mDeferStart) {
                    if (this.f4276b) {
                        this.J = true;
                    } else {
                        i7.mDeferStart = false;
                        p0Var.k();
                    }
                }
            }
        }
        q0Var.f4360b.values().removeAll(Collections.singleton(null));
        return zR;
    }

    public final boolean R(ArrayList arrayList, ArrayList arrayList2, int i, int i5) {
        boolean z5 = (i5 & 1) != 0;
        int size = -1;
        if (!this.f4278d.isEmpty()) {
            if (i < 0) {
                size = z5 ? 0 : this.f4278d.size() - 1;
            } else {
                int size2 = this.f4278d.size() - 1;
                while (size2 >= 0) {
                    C0262a c0262a = (C0262a) this.f4278d.get(size2);
                    if (i >= 0 && i == c0262a.f4222r) {
                        break;
                    }
                    size2--;
                }
                if (size2 < 0) {
                    size = size2;
                } else if (z5) {
                    size = size2;
                    while (size > 0) {
                        C0262a c0262a2 = (C0262a) this.f4278d.get(size - 1);
                        if (i < 0 || i != c0262a2.f4222r) {
                            break;
                        }
                        size--;
                    }
                } else if (size2 != this.f4278d.size() - 1) {
                    size = size2 + 1;
                }
            }
        }
        if (size < 0) {
            return false;
        }
        for (int size3 = this.f4278d.size() - 1; size3 >= size; size3--) {
            arrayList.add((C0262a) this.f4278d.remove(size3));
            arrayList2.add(Boolean.TRUE);
        }
        return true;
    }

    public final void S(I i) {
        if (J(2)) {
            Log.v("FragmentManager", "remove: " + i + " nesting=" + i.mBackStackNesting);
        }
        boolean zIsInBackStack = i.isInBackStack();
        if (i.mDetached && zIsInBackStack) {
            return;
        }
        q0 q0Var = this.f4277c;
        synchronized (q0Var.f4359a) {
            q0Var.f4359a.remove(i);
        }
        i.mAdded = false;
        if (K(i)) {
            this.f4268F = true;
        }
        i.mRemoving = true;
        a0(i);
    }

    public final void T(ArrayList arrayList, ArrayList arrayList2) {
        if (arrayList.isEmpty()) {
            return;
        }
        if (arrayList.size() != arrayList2.size()) {
            throw new IllegalStateException("Internal error with the back stack records");
        }
        int size = arrayList.size();
        int i = 0;
        int i5 = 0;
        while (i < size) {
            if (!((C0262a) arrayList.get(i)).f4221o) {
                if (i5 != i) {
                    A(arrayList, arrayList2, i5, i);
                }
                i5 = i + 1;
                if (((Boolean) arrayList2.get(i)).booleanValue()) {
                    while (i5 < size && ((Boolean) arrayList2.get(i5)).booleanValue() && !((C0262a) arrayList.get(i5)).f4221o) {
                        i5++;
                    }
                }
                A(arrayList, arrayList2, i, i5);
                i = i5 - 1;
            }
            i++;
        }
        if (i5 != size) {
            A(arrayList, arrayList2, i5, size);
        }
    }

    public final void U(Bundle bundle) {
        int i;
        O o5;
        int i5;
        p0 p0Var;
        Bundle bundle2;
        Bundle bundle3;
        for (String str : bundle.keySet()) {
            if (str.startsWith("result_") && (bundle3 = bundle.getBundle(str)) != null) {
                bundle3.setClassLoader(this.f4293v.f4196l.getClassLoader());
                this.f4285l.put(str.substring(7), bundle3);
            }
        }
        HashMap map = new HashMap();
        for (String str2 : bundle.keySet()) {
            if (str2.startsWith("fragment_") && (bundle2 = bundle.getBundle(str2)) != null) {
                bundle2.setClassLoader(this.f4293v.f4196l.getClassLoader());
                map.put(str2.substring(9), bundle2);
            }
        }
        q0 q0Var = this.f4277c;
        HashMap map2 = q0Var.f4361c;
        map2.clear();
        map2.putAll(map);
        j0 j0Var = (j0) bundle.getParcelable("state");
        if (j0Var == null) {
            return;
        }
        HashMap map3 = q0Var.f4360b;
        map3.clear();
        Iterator it = j0Var.f4301k.iterator();
        while (true) {
            boolean zHasNext = it.hasNext();
            i = 2;
            o5 = this.f4287n;
            if (!zHasNext) {
                break;
            }
            Bundle bundleI = q0Var.i(null, (String) it.next());
            if (bundleI != null) {
                I i6 = (I) this.f4273N.f4311d.get(((n0) bundleI.getParcelable("state")).f4332l);
                if (i6 != null) {
                    if (J(2)) {
                        Log.v("FragmentManager", "restoreSaveState: re-attaching retained " + i6);
                    }
                    p0Var = new p0(o5, q0Var, i6, bundleI);
                } else {
                    p0Var = new p0(this.f4287n, this.f4277c, this.f4293v.f4196l.getClassLoader(), G(), bundleI);
                }
                I i7 = p0Var.f4351c;
                i7.mSavedFragmentState = bundleI;
                i7.mFragmentManager = this;
                if (J(2)) {
                    Log.v("FragmentManager", "restoreSaveState: active (" + i7.mWho + "): " + i7);
                }
                p0Var.l(this.f4293v.f4196l.getClassLoader());
                q0Var.g(p0Var);
                p0Var.f4353e = this.f4292u;
            }
        }
        l0 l0Var = this.f4273N;
        l0Var.getClass();
        for (I i8 : new ArrayList(l0Var.f4311d.values())) {
            if (map3.get(i8.mWho) == null) {
                if (J(2)) {
                    Log.v("FragmentManager", "Discarding retained Fragment " + i8 + " that was not found in the set of active Fragments " + j0Var.f4301k);
                }
                this.f4273N.g(i8);
                i8.mFragmentManager = this;
                p0 p0Var2 = new p0(o5, q0Var, i8);
                p0Var2.f4353e = 1;
                p0Var2.k();
                i8.mRemoving = true;
                p0Var2.k();
            }
        }
        ArrayList<String> arrayList = j0Var.f4302l;
        q0Var.f4359a.clear();
        if (arrayList != null) {
            for (String str3 : arrayList) {
                I iB = q0Var.b(str3);
                if (iB == null) {
                    throw new IllegalStateException(AbstractC0928a.l("No instantiated fragment for (", str3, ")"));
                }
                if (J(2)) {
                    Log.v("FragmentManager", "restoreSaveState: added (" + str3 + "): " + iB);
                }
                q0Var.a(iB);
            }
        }
        if (j0Var.f4303m != null) {
            this.f4278d = new ArrayList(j0Var.f4303m.length);
            int i9 = 0;
            while (true) {
                C0264b[] c0264bArr = j0Var.f4303m;
                if (i9 >= c0264bArr.length) {
                    break;
                }
                C0264b c0264b = c0264bArr[i9];
                c0264b.getClass();
                C0262a c0262a = new C0262a(this);
                int i10 = 0;
                int i11 = 0;
                while (true) {
                    int[] iArr = c0264b.f4225k;
                    if (i10 >= iArr.length) {
                        break;
                    }
                    r0 r0Var = new r0();
                    int i12 = i10 + 1;
                    int i13 = i;
                    r0Var.f4365a = iArr[i10];
                    if (J(i13)) {
                        Log.v("FragmentManager", "Instantiate " + c0262a + " op #" + i11 + " base fragment #" + iArr[i12]);
                    }
                    r0Var.f4372h = EnumC0308o.values()[c0264b.f4227m[i11]];
                    r0Var.i = EnumC0308o.values()[c0264b.f4228n[i11]];
                    int i14 = i10 + 2;
                    r0Var.f4367c = iArr[i12] != 0;
                    int i15 = iArr[i14];
                    r0Var.f4368d = i15;
                    int i16 = iArr[i10 + 3];
                    r0Var.f4369e = i16;
                    int i17 = i10 + 5;
                    int i18 = iArr[i10 + 4];
                    r0Var.f4370f = i18;
                    i10 += 6;
                    int i19 = iArr[i17];
                    r0Var.f4371g = i19;
                    c0262a.f4209b = i15;
                    c0262a.f4210c = i16;
                    c0262a.f4211d = i18;
                    c0262a.f4212e = i19;
                    c0262a.b(r0Var);
                    i11++;
                    i = i13;
                }
                int i20 = i;
                c0262a.f4213f = c0264b.f4229o;
                c0262a.f4215h = c0264b.p;
                c0262a.f4214g = true;
                c0262a.i = c0264b.f4230r;
                c0262a.f4216j = c0264b.f4231s;
                c0262a.f4217k = c0264b.f4232t;
                c0262a.f4218l = c0264b.f4233u;
                c0262a.f4219m = c0264b.f4234v;
                c0262a.f4220n = c0264b.f4235w;
                c0262a.f4221o = c0264b.f4236x;
                c0262a.f4222r = c0264b.q;
                int i21 = 0;
                while (true) {
                    ArrayList arrayList2 = c0264b.f4226l;
                    if (i21 >= arrayList2.size()) {
                        break;
                    }
                    String str4 = (String) arrayList2.get(i21);
                    if (str4 != null) {
                        ((r0) c0262a.f4208a.get(i21)).f4366b = q0Var.b(str4);
                    }
                    i21++;
                }
                c0262a.c(1);
                if (J(i20)) {
                    StringBuilder sbM = AbstractC0928a.m(i9, "restoreAllState: back stack #", " (index ");
                    sbM.append(c0262a.f4222r);
                    sbM.append("): ");
                    sbM.append(c0262a);
                    Log.v("FragmentManager", sbM.toString());
                    PrintWriter printWriter = new PrintWriter(new B0());
                    c0262a.f("  ", printWriter, false);
                    printWriter.close();
                }
                this.f4278d.add(c0262a);
                i9++;
                i = i20;
            }
            i5 = 0;
        } else {
            i5 = 0;
            this.f4278d = new ArrayList();
        }
        this.f4283j.set(j0Var.f4304n);
        String str5 = j0Var.f4305o;
        if (str5 != null) {
            I iB2 = q0Var.b(str5);
            this.f4296y = iB2;
            r(iB2);
        }
        ArrayList arrayList3 = j0Var.p;
        if (arrayList3 != null) {
            for (int i22 = i5; i22 < arrayList3.size(); i22++) {
                this.f4284k.put((String) arrayList3.get(i22), (C0266c) j0Var.q.get(i22));
            }
        }
        this.f4267E = new ArrayDeque(j0Var.f4306r);
    }

    public final Bundle V() {
        ArrayList arrayList;
        C0264b[] c0264bArr;
        Bundle bundle = new Bundle();
        D();
        w();
        z(true);
        this.f4269G = true;
        this.f4273N.i = true;
        q0 q0Var = this.f4277c;
        q0Var.getClass();
        HashMap map = q0Var.f4360b;
        ArrayList arrayList2 = new ArrayList(map.size());
        for (p0 p0Var : map.values()) {
            if (p0Var != null) {
                I i = p0Var.f4351c;
                q0Var.i(p0Var.n(), i.mWho);
                arrayList2.add(i.mWho);
                if (J(2)) {
                    Log.v("FragmentManager", "Saved state of " + i + ": " + i.mSavedFragmentState);
                }
            }
        }
        HashMap map2 = this.f4277c.f4361c;
        if (!map2.isEmpty()) {
            q0 q0Var2 = this.f4277c;
            synchronized (q0Var2.f4359a) {
                try {
                    if (q0Var2.f4359a.isEmpty()) {
                        arrayList = null;
                    } else {
                        arrayList = new ArrayList(q0Var2.f4359a.size());
                        for (I i5 : q0Var2.f4359a) {
                            arrayList.add(i5.mWho);
                            if (J(2)) {
                                Log.v("FragmentManager", "saveAllState: adding fragment (" + i5.mWho + "): " + i5);
                            }
                        }
                    }
                } finally {
                }
            }
            int size = this.f4278d.size();
            if (size > 0) {
                c0264bArr = new C0264b[size];
                for (int i6 = 0; i6 < size; i6++) {
                    c0264bArr[i6] = new C0264b((C0262a) this.f4278d.get(i6));
                    if (J(2)) {
                        StringBuilder sbM = AbstractC0928a.m(i6, "saveAllState: adding back stack #", ": ");
                        sbM.append(this.f4278d.get(i6));
                        Log.v("FragmentManager", sbM.toString());
                    }
                }
            } else {
                c0264bArr = null;
            }
            j0 j0Var = new j0();
            j0Var.f4305o = null;
            ArrayList arrayList3 = new ArrayList();
            j0Var.p = arrayList3;
            ArrayList arrayList4 = new ArrayList();
            j0Var.q = arrayList4;
            j0Var.f4301k = arrayList2;
            j0Var.f4302l = arrayList;
            j0Var.f4303m = c0264bArr;
            j0Var.f4304n = this.f4283j.get();
            I i7 = this.f4296y;
            if (i7 != null) {
                j0Var.f4305o = i7.mWho;
            }
            arrayList3.addAll(this.f4284k.keySet());
            arrayList4.addAll(this.f4284k.values());
            j0Var.f4306r = new ArrayList(this.f4267E);
            bundle.putParcelable("state", j0Var);
            for (String str : this.f4285l.keySet()) {
                bundle.putBundle(s0.c.f("result_", str), (Bundle) this.f4285l.get(str));
            }
            for (String str2 : map2.keySet()) {
                bundle.putBundle(s0.c.f("fragment_", str2), (Bundle) map2.get(str2));
            }
        } else if (J(2)) {
            Log.v("FragmentManager", "saveAllState: no fragments!");
            return bundle;
        }
        return bundle;
    }

    public final void W() {
        synchronized (this.f4275a) {
            try {
                if (this.f4275a.size() == 1) {
                    this.f4293v.f4197m.removeCallbacks(this.f4274O);
                    this.f4293v.f4197m.post(this.f4274O);
                    d0();
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final void X(I i, boolean z5) {
        ViewGroup viewGroupF = F(i);
        if (viewGroupF == null || !(viewGroupF instanceof FragmentContainerView)) {
            return;
        }
        ((FragmentContainerView) viewGroupF).setDrawDisappearingViewsLast(!z5);
    }

    public final void Y(I i, EnumC0308o enumC0308o) {
        if (i.equals(this.f4277c.b(i.mWho)) && (i.mHost == null || i.mFragmentManager == this)) {
            i.mMaxState = enumC0308o;
            return;
        }
        throw new IllegalArgumentException("Fragment " + i + " is not an active fragment of FragmentManager " + this);
    }

    public final void Z(I i) {
        if (i != null) {
            if (!i.equals(this.f4277c.b(i.mWho)) || (i.mHost != null && i.mFragmentManager != this)) {
                throw new IllegalArgumentException("Fragment " + i + " is not an active fragment of FragmentManager " + this);
            }
        }
        I i5 = this.f4296y;
        this.f4296y = i;
        r(i5);
        r(this.f4296y);
    }

    public final p0 a(I i) {
        String str = i.mPreviousWho;
        if (str != null) {
            g0.d.c(i, str);
        }
        if (J(2)) {
            Log.v("FragmentManager", "add: " + i);
        }
        p0 p0VarG = g(i);
        i.mFragmentManager = this;
        q0 q0Var = this.f4277c;
        q0Var.g(p0VarG);
        if (!i.mDetached) {
            q0Var.a(i);
            i.mRemoving = false;
            if (i.mView == null) {
                i.mHiddenChanged = false;
            }
            if (K(i)) {
                this.f4268F = true;
            }
        }
        return p0VarG;
    }

    public final void a0(I i) {
        ViewGroup viewGroupF = F(i);
        if (viewGroupF != null) {
            if (i.getPopExitAnim() + i.getPopEnterAnim() + i.getExitAnim() + i.getEnterAnim() > 0) {
                if (viewGroupF.getTag(R.id.visible_removing_fragment_view_tag) == null) {
                    viewGroupF.setTag(R.id.visible_removing_fragment_view_tag, i);
                }
                ((I) viewGroupF.getTag(R.id.visible_removing_fragment_view_tag)).setPopDirection(i.getPopDirection());
            }
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    public final void b(T t4, Q q, I i) {
        if (this.f4293v != null) {
            throw new IllegalStateException("Already attached");
        }
        this.f4293v = t4;
        this.f4294w = q;
        this.f4295x = i;
        CopyOnWriteArrayList copyOnWriteArrayList = this.f4288o;
        if (i != null) {
            copyOnWriteArrayList.add(new C0265b0(i));
        } else if (t4 instanceof m0) {
            copyOnWriteArrayList.add((m0) t4);
        }
        if (this.f4295x != null) {
            d0();
        }
        if (t4 instanceof InterfaceC0528v) {
            InterfaceC0528v interfaceC0528v = (InterfaceC0528v) t4;
            C0527u onBackPressedDispatcher = interfaceC0528v.getOnBackPressedDispatcher();
            this.f4281g = onBackPressedDispatcher;
            InterfaceC0313u interfaceC0313u = interfaceC0528v;
            if (i != null) {
                interfaceC0313u = i;
            }
            onBackPressedDispatcher.a(interfaceC0313u, this.i);
        }
        if (i != null) {
            l0 l0Var = i.mFragmentManager.f4273N;
            HashMap map = l0Var.f4312e;
            l0 l0Var2 = (l0) map.get(i.mWho);
            if (l0Var2 == null) {
                l0Var2 = new l0(l0Var.f4314g);
                map.put(i.mWho, l0Var2);
            }
            this.f4273N = l0Var2;
        } else if (t4 instanceof androidx.lifecycle.d0) {
            B2.a aVar = new B2.a(((androidx.lifecycle.d0) t4).getViewModelStore(), l0.f4310j);
            String canonicalName = l0.class.getCanonicalName();
            if (canonicalName == null) {
                throw new IllegalArgumentException("Local and anonymous classes can not be ViewModels");
            }
            this.f4273N = (l0) aVar.p(l0.class, "androidx.lifecycle.ViewModelProvider.DefaultKey:".concat(canonicalName));
        } else {
            this.f4273N = new l0(false);
        }
        l0 l0Var3 = this.f4273N;
        l0Var3.i = this.f4269G || this.f4270H;
        this.f4277c.f4362d = l0Var3;
        Object obj = this.f4293v;
        if ((obj instanceof v0.g) && i == null) {
            v0.e savedStateRegistry = ((v0.g) obj).getSavedStateRegistry();
            savedStateRegistry.c("android:support:fragments", new J(1, this));
            Bundle bundleA = savedStateRegistry.a("android:support:fragments");
            if (bundleA != null) {
                U(bundleA);
            }
        }
        Object obj2 = this.f4293v;
        if (obj2 instanceof InterfaceC0586i) {
            AbstractC0585h activityResultRegistry = ((InterfaceC0586i) obj2).getActivityResultRegistry();
            String strF = s0.c.f("FragmentManager:", i != null ? s0.c.e(new StringBuilder(), i.mWho, ":") : "");
            this.f4264B = activityResultRegistry.d(s0.c.c(strF, "StartActivityForResult"), new C0267c0(3), new X(this, 1));
            this.f4265C = activityResultRegistry.d(s0.c.c(strF, "StartIntentSenderForResult"), new C0267c0(0), new X(this, 2));
            this.f4266D = activityResultRegistry.d(s0.c.c(strF, "RequestPermissions"), new C0267c0(2), new X(this, 0));
        }
        Object obj3 = this.f4293v;
        if (obj3 instanceof E.g) {
            ((E.g) obj3).addOnConfigurationChangedListener(this.p);
        }
        Object obj4 = this.f4293v;
        if (obj4 instanceof E.h) {
            ((E.h) obj4).addOnTrimMemoryListener(this.q);
        }
        Object obj5 = this.f4293v;
        if (obj5 instanceof D.W) {
            ((D.W) obj5).addOnMultiWindowModeChangedListener(this.f4289r);
        }
        Object obj6 = this.f4293v;
        if (obj6 instanceof D.X) {
            ((D.X) obj6).addOnPictureInPictureModeChangedListener(this.f4290s);
        }
        Object obj7 = this.f4293v;
        if ((obj7 instanceof InterfaceC0166j) && i == null) {
            ((InterfaceC0166j) obj7).addMenuProvider(this.f4291t);
        }
    }

    public final void c(I i) {
        if (J(2)) {
            Log.v("FragmentManager", "attach: " + i);
        }
        if (i.mDetached) {
            i.mDetached = false;
            if (i.mAdded) {
                return;
            }
            this.f4277c.a(i);
            if (J(2)) {
                Log.v("FragmentManager", "add from attach: " + i);
            }
            if (K(i)) {
                this.f4268F = true;
            }
        }
    }

    public final void c0(IllegalStateException illegalStateException) {
        Log.e("FragmentManager", illegalStateException.getMessage());
        Log.e("FragmentManager", "Activity state:");
        PrintWriter printWriter = new PrintWriter(new B0());
        T t4 = this.f4293v;
        if (t4 == null) {
            try {
                v("  ", null, printWriter, new String[0]);
                throw illegalStateException;
            } catch (Exception e2) {
                Log.e("FragmentManager", "Failed dumping state", e2);
                throw illegalStateException;
            }
        }
        try {
            ((M) t4).f4186o.dump("  ", null, printWriter, new String[0]);
            throw illegalStateException;
        } catch (Exception e6) {
            Log.e("FragmentManager", "Failed dumping state", e6);
            throw illegalStateException;
        }
    }

    public final void d() {
        this.f4276b = false;
        this.f4271L.clear();
        this.K.clear();
    }

    public final void d0() {
        synchronized (this.f4275a) {
            try {
                if (!this.f4275a.isEmpty()) {
                    this.i.setEnabled(true);
                    if (J(3)) {
                        Log.d("FragmentManager", "FragmentManager " + this + " enabling OnBackPressedCallback, caused by non-empty pending actions");
                    }
                    return;
                }
                boolean z5 = this.f4278d.size() + (this.f4282h != null ? 1 : 0) > 0 && M(this.f4295x);
                if (J(3)) {
                    Log.d("FragmentManager", "OnBackPressedCallback for FragmentManager " + this + " enabled state is " + z5);
                }
                this.i.setEnabled(z5);
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final HashSet e() {
        C0285q c0285q;
        HashSet hashSet = new HashSet();
        Iterator it = this.f4277c.d().iterator();
        while (it.hasNext()) {
            ViewGroup viewGroup = ((p0) it.next()).f4351c.mContainer;
            if (viewGroup != null) {
                AbstractC0983h.e("factory", H());
                Object tag = viewGroup.getTag(R.id.special_effects_controller_view_tag);
                if (tag instanceof C0285q) {
                    c0285q = (C0285q) tag;
                } else {
                    c0285q = new C0285q(viewGroup);
                    viewGroup.setTag(R.id.special_effects_controller_view_tag, c0285q);
                }
                hashSet.add(c0285q);
            }
        }
        return hashSet;
    }

    public final HashSet f(ArrayList arrayList, int i, int i5) {
        ViewGroup viewGroup;
        HashSet hashSet = new HashSet();
        while (i < i5) {
            Iterator it = ((C0262a) arrayList.get(i)).f4208a.iterator();
            while (it.hasNext()) {
                I i6 = ((r0) it.next()).f4366b;
                if (i6 != null && (viewGroup = i6.mContainer) != null) {
                    hashSet.add(C0285q.j(viewGroup, this));
                }
            }
            i++;
        }
        return hashSet;
    }

    public final p0 g(I i) {
        String str = i.mWho;
        q0 q0Var = this.f4277c;
        p0 p0Var = (p0) q0Var.f4360b.get(str);
        if (p0Var != null) {
            return p0Var;
        }
        p0 p0Var2 = new p0(this.f4287n, q0Var, i);
        p0Var2.l(this.f4293v.f4196l.getClassLoader());
        p0Var2.f4353e = this.f4292u;
        return p0Var2;
    }

    public final void h(I i) {
        if (J(2)) {
            Log.v("FragmentManager", "detach: " + i);
        }
        if (i.mDetached) {
            return;
        }
        i.mDetached = true;
        if (i.mAdded) {
            if (J(2)) {
                Log.v("FragmentManager", "remove from detach: " + i);
            }
            q0 q0Var = this.f4277c;
            synchronized (q0Var.f4359a) {
                q0Var.f4359a.remove(i);
            }
            i.mAdded = false;
            if (K(i)) {
                this.f4268F = true;
            }
            a0(i);
        }
    }

    public final void i(boolean z5, Configuration configuration) {
        if (z5 && (this.f4293v instanceof E.g)) {
            c0(new IllegalStateException("Do not call dispatchConfigurationChanged() on host. Host implements OnConfigurationChangedProvider and automatically dispatches configuration changes to fragments."));
            throw null;
        }
        for (I i : this.f4277c.f()) {
            if (i != null) {
                i.performConfigurationChanged(configuration);
                if (z5) {
                    i.mChildFragmentManager.i(true, configuration);
                }
            }
        }
    }

    public final boolean j(MenuItem menuItem) {
        if (this.f4292u < 1) {
            return false;
        }
        for (I i : this.f4277c.f()) {
            if (i != null && i.performContextItemSelected(menuItem)) {
                return true;
            }
        }
        return false;
    }

    public final boolean k(Menu menu, MenuInflater menuInflater) {
        if (this.f4292u < 1) {
            return false;
        }
        ArrayList arrayList = null;
        boolean z5 = false;
        for (I i : this.f4277c.f()) {
            if (i != null && i.isMenuVisible() && i.performCreateOptionsMenu(menu, menuInflater)) {
                if (arrayList == null) {
                    arrayList = new ArrayList();
                }
                arrayList.add(i);
                z5 = true;
            }
        }
        if (this.f4279e != null) {
            for (int i5 = 0; i5 < this.f4279e.size(); i5++) {
                I i6 = (I) this.f4279e.get(i5);
                if (arrayList == null || !arrayList.contains(i6)) {
                    i6.onDestroyOptionsMenu();
                }
            }
        }
        this.f4279e = arrayList;
        return z5;
    }

    public final void l() {
        boolean zIsChangingConfigurations = true;
        this.I = true;
        z(true);
        w();
        T t4 = this.f4293v;
        boolean z5 = t4 instanceof androidx.lifecycle.d0;
        q0 q0Var = this.f4277c;
        if (z5) {
            zIsChangingConfigurations = q0Var.f4362d.f4315h;
        } else {
            N n5 = t4.f4196l;
            if (n5 != null) {
                zIsChangingConfigurations = true ^ n5.isChangingConfigurations();
            }
        }
        if (zIsChangingConfigurations) {
            Iterator it = this.f4284k.values().iterator();
            while (it.hasNext()) {
                Iterator it2 = ((C0266c) it.next()).f4238k.iterator();
                while (it2.hasNext()) {
                    q0Var.f4362d.e((String) it2.next(), false);
                }
            }
        }
        u(-1);
        Object obj = this.f4293v;
        if (obj instanceof E.h) {
            ((E.h) obj).removeOnTrimMemoryListener(this.q);
        }
        Object obj2 = this.f4293v;
        if (obj2 instanceof E.g) {
            ((E.g) obj2).removeOnConfigurationChangedListener(this.p);
        }
        Object obj3 = this.f4293v;
        if (obj3 instanceof D.W) {
            ((D.W) obj3).removeOnMultiWindowModeChangedListener(this.f4289r);
        }
        Object obj4 = this.f4293v;
        if (obj4 instanceof D.X) {
            ((D.X) obj4).removeOnPictureInPictureModeChangedListener(this.f4290s);
        }
        Object obj5 = this.f4293v;
        if ((obj5 instanceof InterfaceC0166j) && this.f4295x == null) {
            ((InterfaceC0166j) obj5).removeMenuProvider(this.f4291t);
        }
        this.f4293v = null;
        this.f4294w = null;
        this.f4295x = null;
        if (this.f4281g != null) {
            this.i.remove();
            this.f4281g = null;
        }
        C0584g c0584g = this.f4264B;
        if (c0584g != null) {
            c0584g.b();
            this.f4265C.b();
            this.f4266D.b();
        }
    }

    public final void m(boolean z5) {
        if (z5 && (this.f4293v instanceof E.h)) {
            c0(new IllegalStateException("Do not call dispatchLowMemory() on host. Host implements OnTrimMemoryProvider and automatically dispatches low memory callbacks to fragments."));
            throw null;
        }
        for (I i : this.f4277c.f()) {
            if (i != null) {
                i.performLowMemory();
                if (z5) {
                    i.mChildFragmentManager.m(true);
                }
            }
        }
    }

    public final void n(boolean z5, boolean z6) {
        if (z6 && (this.f4293v instanceof D.W)) {
            c0(new IllegalStateException("Do not call dispatchMultiWindowModeChanged() on host. Host implements OnMultiWindowModeChangedProvider and automatically dispatches multi-window mode changes to fragments."));
            throw null;
        }
        for (I i : this.f4277c.f()) {
            if (i != null) {
                i.performMultiWindowModeChanged(z5);
                if (z6) {
                    i.mChildFragmentManager.n(z5, true);
                }
            }
        }
    }

    public final void o() {
        for (I i : this.f4277c.e()) {
            if (i != null) {
                i.onHiddenChanged(i.isHidden());
                i.mChildFragmentManager.o();
            }
        }
    }

    public final boolean p(MenuItem menuItem) {
        if (this.f4292u < 1) {
            return false;
        }
        for (I i : this.f4277c.f()) {
            if (i != null && i.performOptionsItemSelected(menuItem)) {
                return true;
            }
        }
        return false;
    }

    public final void q(Menu menu) {
        if (this.f4292u < 1) {
            return;
        }
        for (I i : this.f4277c.f()) {
            if (i != null) {
                i.performOptionsMenuClosed(menu);
            }
        }
    }

    public final void r(I i) {
        if (i != null) {
            if (i.equals(this.f4277c.b(i.mWho))) {
                i.performPrimaryNavigationFragmentChanged();
            }
        }
    }

    public final void s(boolean z5, boolean z6) {
        if (z6 && (this.f4293v instanceof D.X)) {
            c0(new IllegalStateException("Do not call dispatchPictureInPictureModeChanged() on host. Host implements OnPictureInPictureModeChangedProvider and automatically dispatches picture-in-picture mode changes to fragments."));
            throw null;
        }
        for (I i : this.f4277c.f()) {
            if (i != null) {
                i.performPictureInPictureModeChanged(z5);
                if (z6) {
                    i.mChildFragmentManager.s(z5, true);
                }
            }
        }
    }

    public final boolean t(Menu menu) {
        boolean z5 = false;
        if (this.f4292u < 1) {
            return false;
        }
        for (I i : this.f4277c.f()) {
            if (i != null && i.isMenuVisible() && i.performPrepareOptionsMenu(menu)) {
                z5 = true;
            }
        }
        return z5;
    }

    public final String toString() {
        StringBuilder sb = new StringBuilder(128);
        sb.append("FragmentManager{");
        sb.append(Integer.toHexString(System.identityHashCode(this)));
        sb.append(" in ");
        I i = this.f4295x;
        if (i != null) {
            sb.append(i.getClass().getSimpleName());
            sb.append("{");
            sb.append(Integer.toHexString(System.identityHashCode(this.f4295x)));
            sb.append("}");
        } else {
            T t4 = this.f4293v;
            if (t4 != null) {
                sb.append(t4.getClass().getSimpleName());
                sb.append("{");
                sb.append(Integer.toHexString(System.identityHashCode(this.f4293v)));
                sb.append("}");
            } else {
                sb.append("null");
            }
        }
        sb.append("}}");
        return sb.toString();
    }

    public final void u(int i) {
        try {
            this.f4276b = true;
            for (p0 p0Var : this.f4277c.f4360b.values()) {
                if (p0Var != null) {
                    p0Var.f4353e = i;
                }
            }
            N(i, false);
            Iterator it = e().iterator();
            while (it.hasNext()) {
                ((C0285q) it.next()).i();
            }
            this.f4276b = false;
            z(true);
        } catch (Throwable th) {
            this.f4276b = false;
            throw th;
        }
    }

    public final void v(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
        int size;
        String strC = s0.c.c(str, "    ");
        q0 q0Var = this.f4277c;
        q0Var.getClass();
        String str2 = str + "    ";
        HashMap map = q0Var.f4360b;
        if (!map.isEmpty()) {
            printWriter.print(str);
            printWriter.println("Active Fragments:");
            for (p0 p0Var : map.values()) {
                printWriter.print(str);
                if (p0Var != null) {
                    I i = p0Var.f4351c;
                    printWriter.println(i);
                    i.dump(str2, fileDescriptor, printWriter, strArr);
                } else {
                    printWriter.println("null");
                }
            }
        }
        ArrayList arrayList = q0Var.f4359a;
        int size2 = arrayList.size();
        if (size2 > 0) {
            printWriter.print(str);
            printWriter.println("Added Fragments:");
            for (int i5 = 0; i5 < size2; i5++) {
                I i6 = (I) arrayList.get(i5);
                printWriter.print(str);
                printWriter.print("  #");
                printWriter.print(i5);
                printWriter.print(": ");
                printWriter.println(i6.toString());
            }
        }
        ArrayList arrayList2 = this.f4279e;
        if (arrayList2 != null && (size = arrayList2.size()) > 0) {
            printWriter.print(str);
            printWriter.println("Fragments Created Menus:");
            for (int i7 = 0; i7 < size; i7++) {
                I i8 = (I) this.f4279e.get(i7);
                printWriter.print(str);
                printWriter.print("  #");
                printWriter.print(i7);
                printWriter.print(": ");
                printWriter.println(i8.toString());
            }
        }
        int size3 = this.f4278d.size();
        if (size3 > 0) {
            printWriter.print(str);
            printWriter.println("Back Stack:");
            for (int i9 = 0; i9 < size3; i9++) {
                C0262a c0262a = (C0262a) this.f4278d.get(i9);
                printWriter.print(str);
                printWriter.print("  #");
                printWriter.print(i9);
                printWriter.print(": ");
                printWriter.println(c0262a.toString());
                c0262a.f(strC, printWriter, true);
            }
        }
        printWriter.print(str);
        printWriter.println("Back Stack Index: " + this.f4283j.get());
        synchronized (this.f4275a) {
            try {
                int size4 = this.f4275a.size();
                if (size4 > 0) {
                    printWriter.print(str);
                    printWriter.println("Pending Actions:");
                    for (int i10 = 0; i10 < size4; i10++) {
                        Object obj = (InterfaceC0271e0) this.f4275a.get(i10);
                        printWriter.print(str);
                        printWriter.print("  #");
                        printWriter.print(i10);
                        printWriter.print(": ");
                        printWriter.println(obj);
                    }
                }
            } catch (Throwable th) {
                throw th;
            }
        }
        printWriter.print(str);
        printWriter.println("FragmentManager misc state:");
        printWriter.print(str);
        printWriter.print("  mHost=");
        printWriter.println(this.f4293v);
        printWriter.print(str);
        printWriter.print("  mContainer=");
        printWriter.println(this.f4294w);
        if (this.f4295x != null) {
            printWriter.print(str);
            printWriter.print("  mParent=");
            printWriter.println(this.f4295x);
        }
        printWriter.print(str);
        printWriter.print("  mCurState=");
        printWriter.print(this.f4292u);
        printWriter.print(" mStateSaved=");
        printWriter.print(this.f4269G);
        printWriter.print(" mStopped=");
        printWriter.print(this.f4270H);
        printWriter.print(" mDestroyed=");
        printWriter.println(this.I);
        if (this.f4268F) {
            printWriter.print(str);
            printWriter.print("  mNeedMenuInvalidate=");
            printWriter.println(this.f4268F);
        }
    }

    public final void w() {
        Iterator it = e().iterator();
        while (it.hasNext()) {
            ((C0285q) it.next()).i();
        }
    }

    public final void x(InterfaceC0271e0 interfaceC0271e0, boolean z5) {
        if (!z5) {
            if (this.f4293v == null) {
                if (!this.I) {
                    throw new IllegalStateException("FragmentManager has not been attached to a host.");
                }
                throw new IllegalStateException("FragmentManager has been destroyed");
            }
            if (this.f4269G || this.f4270H) {
                throw new IllegalStateException("Can not perform this action after onSaveInstanceState");
            }
        }
        synchronized (this.f4275a) {
            try {
                if (this.f4293v == null) {
                    if (!z5) {
                        throw new IllegalStateException("Activity has been destroyed");
                    }
                } else {
                    this.f4275a.add(interfaceC0271e0);
                    W();
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final void y(boolean z5) {
        if (this.f4276b) {
            throw new IllegalStateException("FragmentManager is already executing transactions");
        }
        if (this.f4293v == null) {
            if (!this.I) {
                throw new IllegalStateException("FragmentManager has not been attached to a host.");
            }
            throw new IllegalStateException("FragmentManager has been destroyed");
        }
        if (Looper.myLooper() != this.f4293v.f4197m.getLooper()) {
            throw new IllegalStateException("Must be called from main thread of fragment host");
        }
        if (!z5 && (this.f4269G || this.f4270H)) {
            throw new IllegalStateException("Can not perform this action after onSaveInstanceState");
        }
        if (this.K == null) {
            this.K = new ArrayList();
            this.f4271L = new ArrayList();
        }
    }

    public final boolean z(boolean z5) {
        boolean zA;
        y(z5);
        boolean z6 = false;
        while (true) {
            ArrayList arrayList = this.K;
            ArrayList arrayList2 = this.f4271L;
            synchronized (this.f4275a) {
                if (this.f4275a.isEmpty()) {
                    zA = false;
                } else {
                    try {
                        int size = this.f4275a.size();
                        zA = false;
                        for (int i = 0; i < size; i++) {
                            zA |= ((InterfaceC0271e0) this.f4275a.get(i)).a(arrayList, arrayList2);
                        }
                    } finally {
                    }
                }
            }
            if (!zA) {
                break;
            }
            this.f4276b = true;
            try {
                T(this.K, this.f4271L);
                d();
                z6 = true;
            } catch (Throwable th) {
                d();
                throw th;
            }
        }
        d0();
        if (this.J) {
            this.J = false;
            for (p0 p0Var : this.f4277c.d()) {
                I i5 = p0Var.f4351c;
                if (i5.mDeferStart) {
                    if (this.f4276b) {
                        this.J = true;
                    } else {
                        i5.mDeferStart = false;
                        p0Var.k();
                    }
                }
            }
        }
        this.f4277c.f4360b.values().removeAll(Collections.singleton(null));
        return z6;
    }
}
