package o6;

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Iterator;

/* JADX INFO: renamed from: o6.w, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1403w {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final ArrayDeque f15926b = new ArrayDeque();

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ x f15928d;

    public C1403w(x xVar) {
        this.f15928d = xVar;
    }

    public final IllegalArgumentException a(IllegalArgumentException illegalArgumentException) {
        if (!this.f15927c) {
            this.f15927c = true;
            ArrayDeque arrayDeque = this.f15926b;
            if (arrayDeque.size() != 1 || ((C1402v) arrayDeque.getFirst()).f15922b != null) {
                StringBuilder sb = new StringBuilder(illegalArgumentException.getMessage());
                Iterator itDescendingIterator = arrayDeque.descendingIterator();
                while (itDescendingIterator.hasNext()) {
                    C1402v c1402v = (C1402v) itDescendingIterator.next();
                    sb.append("\nfor ");
                    sb.append(c1402v.f15921a);
                    String str = c1402v.f15922b;
                    if (str != null) {
                        sb.append(' ');
                        sb.append(str);
                    }
                }
                return new IllegalArgumentException(sb.toString(), illegalArgumentException);
            }
        }
        return illegalArgumentException;
    }

    public final void b(boolean z8) {
        this.f15926b.removeLast();
        if (this.f15926b.isEmpty()) {
            this.f15928d.f15931b.remove();
            if (z8) {
                synchronized (this.f15928d.f15932c) {
                    try {
                        int size = this.f15925a.size();
                        for (int i = 0; i < size; i++) {
                            C1402v c1402v = (C1402v) this.f15925a.get(i);
                            AbstractC1391k abstractC1391k = (AbstractC1391k) this.f15928d.f15932c.put(c1402v.f15923c, c1402v.f15924d);
                            if (abstractC1391k != null) {
                                c1402v.f15924d = abstractC1391k;
                                this.f15928d.f15932c.put(c1402v.f15923c, abstractC1391k);
                            }
                        }
                    } catch (Throwable th) {
                        throw th;
                    }
                }
            }
        }
    }
}
