CAG v5.7.4版本的 MD5 值为:bc57ead76a7a30559f0708e9d60d749f

以下内容为反编译后的 m.java 源代码,内容仅作参考


package d.e;

import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.Stack;
import org.htmlcleaner.BelongsTo;
import org.htmlcleaner.ContentType;
import org.htmlcleaner.OptionalOutput;
import org.htmlcleaner.audit.ErrorType;
public class m {
    public f a;
    public g b;

    public class b {
        public Stack<e> a = new Stack<>();
        public Stack<e> b = new Stack<>();

        public b(m mVar, a aVar) {
        }

        public int a() {
            if (this.b.isEmpty()) {
                return -1;
            }
            return this.b.peek().a;
        }

        public e b() {
            this.b.pop();
            return this.a.pop();
        }
    }

    public class c {
        public d a;
        public b b;

        public c() {
            this.a = new d();
            this.b = new b(m.this, null);
        }
    }

    public class d {
        public e b;
        public List<e> a = new ArrayList();
        public Set<String> c = new HashSet();

        public d() {
        }

        public final e a(String str) {
            boolean z;
            if (str != null) {
                List<e> list = this.a;
                ListIterator<e> listIterator = list.listIterator(list.size());
                s a = m.this.a.a.a(str);
                while (listIterator.hasPrevious()) {
                    if (Thread.currentThread().isInterrupted()) {
                        Objects.requireNonNull(m.this);
                        return null;
                    }
                    e previous = listIterator.previous();
                    if (str.equals(previous.b)) {
                        return previous;
                    }
                    if (a != null) {
                        String str2 = previous.b;
                        Iterator<String> it = a.f7260k.iterator();
                        while (true) {
                            if (!it.hasNext()) {
                                z = false;
                                break;
                            } else if (str2.equals(it.next())) {
                                z = true;
                                break;
                            }
                        }
                        if (z) {
                            break;
                        }
                    }
                }
            }
            return null;
        }
    }

    public class e {
        public int a;
        public String b;
        public s c;

        public e(m mVar, int i2, String str) {
            this.a = i2;
            this.b = str;
            this.c = mVar.a.a.a(str);
        }
    }

    public m() {
        f fVar = new f();
        this.a = fVar;
        if (fVar.a == null) {
            fVar.a = l.b;
        }
    }

    public final void a(t tVar, Map<String, String> map) {
        Map<String, String> g2 = tVar.g();
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String key = entry.getKey();
            if (!g2.containsKey(key)) {
                tVar.a(key, entry.getValue());
            }
        }
    }

    public final void b(s sVar, t tVar, d.e.e eVar) {
        if (sVar != null) {
            BelongsTo belongsTo = sVar.f7258i;
            BelongsTo belongsTo2 = BelongsTo.HEAD;
            boolean z = false;
            if (!(belongsTo == belongsTo2)) {
                if (!((belongsTo == belongsTo2 || belongsTo == BelongsTo.HEAD_AND_BODY) ? true : true) || !eVar.a || eVar.b) {
                    return;
                }
            }
            eVar.c.add(tVar);
        }
    }

    public t c(Reader reader, d.e.e eVar) throws IOException {
        boolean z;
        boolean z2;
        String obj;
        eVar.f7203e.push(new c());
        eVar.a = false;
        eVar.b = false;
        eVar.c.clear();
        eVar.f7202d.clear();
        eVar.f7208j = new HashSet(this.a.f7224o);
        eVar.f7210l = new HashSet(this.a.f7225p);
        this.b = this.a.f7222m;
        eVar.f7209k.clear();
        eVar.f7204f = m("html");
        eVar.f7205g = m("body");
        t m2 = m("head");
        eVar.f7206h = m2;
        eVar.f7207i = null;
        eVar.f7204f.c(m2);
        eVar.f7204f.c(eVar.f7205g);
        n nVar = new n(this, reader, eVar);
        nVar.f7235j = null;
        nVar.f7236k.clear();
        nVar.f7238m = true;
        nVar.f7239n = false;
        nVar.f7233h = false;
        nVar.f7237l.clear();
        nVar.c = 1024;
        nVar.p(0);
        loop0: while (true) {
            boolean z3 = true;
            while (true) {
                if (!nVar.j()) {
                    if (Thread.currentThread().isInterrupted()) {
                        nVar.f7236k.clear();
                        nVar.f7237l.clear();
                        nVar.a.close();
                        break loop0;
                    }
                    StringBuffer stringBuffer = nVar.f7232g;
                    stringBuffer.delete(0, stringBuffer.length());
                    nVar.f7235j = null;
                    nVar.f7238m = true;
                    nVar.p(10);
                    if (nVar.f7239n) {
                        int length = nVar.f7240o.length();
                        StringBuilder J = i.a.b.a.a.J("</");
                        J.append(nVar.f7240o);
                        if (nVar.s(J.toString())) {
                            int i2 = nVar.c + length + 2;
                            int i3 = nVar.f7229d;
                            if (((i3 < 0 || i2 < i3) ? Character.isWhitespace(nVar.b[i2]) : false) || nVar.l(nVar.c + length + 2, '>')) {
                                nVar.u();
                                if (nVar.f7239n) {
                                    break;
                                }
                            }
                        }
                        if (z3 && nVar.s("<!--")) {
                            nVar.e();
                        } else if (!nVar.s("/*<![CDATA[*/") && !nVar.s("<![CDATA[") && !nVar.s("//<![CDATA[")) {
                            boolean f2 = nVar.f();
                            if (z3 && f2) {
                                List<d.e.b> list = nVar.f7236k;
                                d.e.b bVar = list.get(list.size() - 1);
                                if (bVar != null && (obj = bVar.toString()) != null && obj.trim().length() > 0) {
                                    z3 = false;
                                }
                            }
                        } else {
                            nVar.d();
                        }
                        if (nVar.f7239n) {
                        }
                    } else if (nVar.s("<!doctype")) {
                        if (!nVar.f7233h) {
                            nVar.g(9);
                            nVar.r();
                            String h2 = nVar.h(false);
                            nVar.r();
                            String h3 = nVar.h(false);
                            nVar.r();
                            String c2 = nVar.c();
                            nVar.r();
                            String c3 = nVar.c();
                            nVar.r();
                            String c4 = nVar.c();
                            nVar.i('<');
                            if (c4 != null && c4.length() != 0) {
                                nVar.f7234i = new j(h2, h3, c2, c3, c4);
                            } else {
                                nVar.f7234i = new j(h2, h3, c2, c3);
                            }
                            nVar.f7233h = true;
                        } else {
                            nVar.i('<');
                        }
                    } else if (nVar.s("</") && nVar.m(nVar.c + 2)) {
                        nVar.f7233h = true;
                        nVar.u();
                    } else if (!nVar.s("/*<![CDATA[*/") && !nVar.s("<![CDATA[") && !nVar.s("//<![CDATA[")) {
                        if (nVar.s("<!--")) {
                            nVar.e();
                        } else if (nVar.s("<") && nVar.m(nVar.c + 1)) {
                            nVar.f7233h = true;
                            nVar.q();
                            nVar.g(1);
                            if (!nVar.j()) {
                                String h4 = nVar.h(false);
                                g gVar = nVar.f7243r;
                                String str = (!gVar.b(h4) || gVar.a(h4) == null) ? h4 : null;
                                if (str != null) {
                                    s a2 = nVar.f7241p.a.a.a(str);
                                    if (a2 == null) {
                                        Objects.requireNonNull(nVar.f7242q);
                                        Objects.requireNonNull(nVar.f7242q);
                                    }
                                    if (a2 != null && a2.f7263n) {
                                        Objects.requireNonNull(nVar.f7242q);
                                        Objects.requireNonNull(nVar.f7242q);
                                    }
                                }
                                t tVar = new t(str, false);
                                tVar.f7273k = nVar.f7242q.f7219j;
                                nVar.f7235j = tVar;
                                if (nVar.f7238m) {
                                    nVar.r();
                                    nVar.t();
                                    if (str != null) {
                                        g gVar2 = nVar.f7243r;
                                        if (gVar2 != null) {
                                            Map<String, String> h5 = tVar.h();
                                            v a3 = gVar2.a(h4);
                                            if (a3 != null) {
                                                h5 = a3.a(h5);
                                            }
                                            tVar.p(gVar2.b.a(h5));
                                        }
                                        nVar.b(nVar.f7235j);
                                    }
                                    if (nVar.k('>')) {
                                        nVar.g(1);
                                        List<String> list2 = nVar.f7242q.b;
                                        if ((list2 == null || str == null) ? false : list2.contains(str.toLowerCase())) {
                                            nVar.f7239n = true;
                                            nVar.f7240o = str;
                                        }
                                    } else if (nVar.s("/>")) {
                                        nVar.g(2);
                                        nVar.b(new k(str));
                                    }
                                    nVar.f7235j = null;
                                } else {
                                    nVar.a();
                                }
                            }
                        } else if (nVar.f7242q.f7217h && (nVar.s("<!") || nVar.s("<?"))) {
                            nVar.i('<');
                            if (nVar.k('>')) {
                                nVar.g(1);
                            }
                        } else if (nVar.s("<?xml")) {
                            nVar.i('<');
                        } else {
                            nVar.f();
                        }
                    } else {
                        nVar.d();
                    }
                } else {
                    nVar.a.close();
                    break loop0;
                }
            }
        }
        if (Thread.currentThread().isInterrupted()) {
            return null;
        }
        List<d.e.b> list3 = nVar.f7236k;
        d(list3, eVar);
        if (Thread.currentThread().isInterrupted()) {
            return null;
        }
        for (d.e.b bVar2 : list3) {
            if (bVar2 != null) {
                if (bVar2 instanceof t) {
                    t tVar2 = (t) bVar2;
                    b(this.a.a.a(tVar2.b()), tVar2, eVar);
                } else if (bVar2 instanceof i) {
                    z2 = !"".equals(bVar2.toString());
                    if (!z2) {
                        eVar.f7205g.c(bVar2);
                    }
                }
                z2 = true;
                if (!z2) {
                }
            }
        }
        for (t tVar3 : eVar.c) {
            t i4 = tVar3.i();
            while (true) {
                if (i4 == null) {
                    z = true;
                    break;
                } else if (eVar.c.contains(i4)) {
                    z = false;
                    break;
                } else {
                    i4 = i4.i();
                }
            }
            if (z) {
                tVar3.o();
                eVar.f7206h.c(tVar3);
            }
        }
        if (Thread.currentThread().isInterrupted()) {
            return null;
        }
        Set<String> set = nVar.f7237l;
        eVar.f7207i = eVar.f7204f;
        if (this.a.f7214e == OptionalOutput.omit) {
            List<d.e.b> list4 = eVar.f7205g.f7266d;
            eVar.f7207i = new t(null, false);
            if (list4 != null) {
                for (d.e.b bVar3 : list4) {
                    eVar.f7207i.c(bVar3);
                }
            }
        }
        Map<String, String> g2 = eVar.f7207i.g();
        if (eVar.f7207i.j("xmlns")) {
            t tVar4 = eVar.f7207i;
            tVar4.e("", tVar4.f("xmlns"));
        }
        if (this.a.f7218i && set != null) {
            for (String str2 : set) {
                if (!eVar.f7212n.containsKey(str2)) {
                    String r2 = i.a.b.a.a.r("xmlns:", str2);
                    if (!g2.containsKey(r2) && !str2.equals("xml") && !str2.equals("")) {
                        if (str2.equals("svg")) {
                            eVar.f7207i.a(r2, "http://www.w3.org/2000/svg");
                        } else if (str2.equals("xlink")) {
                            eVar.f7207i.a(r2, "http://www.w3.org/1999/xlink");
                        } else {
                            eVar.f7207i.a(r2, str2);
                        }
                    }
                }
            }
        }
        if (Thread.currentThread().isInterrupted()) {
            return null;
        }
        while (l(list3, eVar)) {
            if (Thread.currentThread().isInterrupted()) {
                return null;
            }
        }
        Set<t> set2 = eVar.f7209k;
        if (set2 != null && !set2.isEmpty()) {
            for (t tVar5 : eVar.f7209k) {
                if (Thread.currentThread().isInterrupted()) {
                    return null;
                }
                t i5 = tVar5.i();
                if (i5 != null) {
                    i5.f7266d.remove(tVar5);
                }
            }
        }
        Objects.requireNonNull(eVar.f7207i);
        eVar.f7203e.pop();
        return eVar.f7207i;
    }

    public final void d(List list, d.e.e eVar) {
        d g2 = g(eVar);
        e eVar2 = g2.a.isEmpty() ? null : g2.a.get(0);
        for (e eVar3 : g(eVar).a) {
            if (Thread.currentThread().isInterrupted()) {
                return;
            }
            this.a.c(true, (t) list.get(eVar3.a), ErrorType.UnclosedTag);
        }
        if (eVar2 != null) {
            e(list, eVar2, null, eVar);
        }
    }

    public final List<t> e(List list, e eVar, Object obj, d.e.e eVar2) {
        List<e> list2;
        e eVar3;
        ArrayList arrayList = new ArrayList();
        ListIterator listIterator = list.listIterator(eVar.a);
        Object next = listIterator.next();
        t tVar = null;
        boolean z = false;
        while (true) {
            if (((obj != null || z) && (obj == null || next == obj)) || Thread.currentThread().isInterrupted()) {
                return arrayList;
            }
            if ((next instanceof t) && !((t) next).f7269g) {
                t tVar2 = (t) next;
                arrayList.add(tVar2);
                List<d.e.b> list3 = tVar2.f7267e;
                if (list3 != null) {
                    eVar2.f7203e.push(new c());
                    k(list3, list3.listIterator(0), eVar2);
                    d(list3, eVar2);
                    tVar2.f7267e = null;
                    eVar2.f7203e.pop();
                }
                tVar2.f7269g = true;
                b(h(tVar2.b(), eVar2), tVar2, eVar2);
                if (tVar != null) {
                    tVar.d(list3);
                    tVar.c(tVar2);
                    listIterator.set(null);
                } else if (list3 != null) {
                    list3.add(tVar2);
                    listIterator.set(list3);
                } else {
                    listIterator.set(tVar2);
                }
                d g2 = g(eVar2);
                String b2 = tVar2.b();
                List<e> list4 = g2.a;
                ListIterator<e> listIterator2 = list4.listIterator(list4.size());
                while (true) {
                    if (!listIterator2.hasPrevious()) {
                        break;
                    } else if (Thread.currentThread().isInterrupted()) {
                        Objects.requireNonNull(m.this);
                        break;
                    } else if (b2.equals(listIterator2.previous().b)) {
                        listIterator2.remove();
                        break;
                    }
                }
                if (g2.a.isEmpty()) {
                    eVar3 = null;
                } else {
                    eVar3 = g2.a.get(list2.size() - 1);
                }
                g2.b = eVar3;
                tVar = tVar2;
            } else if (tVar != null) {
                listIterator.set(null);
                if (next != null) {
                    tVar.c(next);
                }
            }
            if (listIterator.hasNext()) {
                next = listIterator.next();
            } else {
                z = true;
            }
        }
    }

    public final b f(d.e.e eVar) {
        return eVar.f7203e.peek().b;
    }

    public final d g(d.e.e eVar) {
        return eVar.f7203e.peek().a;
    }

    public final s h(String str, d.e.e eVar) {
        if (i(str, eVar)) {
            return null;
        }
        return this.a.a.a(str);
    }

    public final boolean i(String str, d.e.e eVar) {
        String peek;
        if (this.a.f7218i && str != null) {
            if (str.contains(":")) {
                return true;
            }
            Stack<String> stack = eVar.f7211m;
            return (stack == null || stack.size() == 0 || (peek = eVar.f7211m.peek()) == null || peek.equals("http://www.w3.org/1999/xhtml")) ? false : true;
        }
        return false;
    }

    public final boolean j(d.e.b bVar, d.e.e eVar) {
        s sVar;
        e eVar2 = g(eVar).b;
        if (eVar2 == null || (sVar = eVar2.c) == null) {
            return true;
        }
        return sVar.b(bVar);
    }

    public void k(List list, ListIterator<d.e.b> listIterator, d.e.e eVar) {
        boolean z;
        s sVar;
        String str;
        boolean z2;
        e a2;
        e a3;
        while (listIterator.hasNext() && !Thread.currentThread().isInterrupted()) {
            d.e.b next = listIterator.next();
            if (next instanceof k) {
                k kVar = (k) next;
                String str2 = kVar.a;
                s h2 = h(str2, eVar);
                if (h2 != null) {
                    str2 = h2.a;
                }
                if (h2 == null) {
                    Objects.requireNonNull(this.a);
                }
                if (h2 != null && h2.f7263n) {
                    Objects.requireNonNull(this.a);
                }
                if (h2 != null) {
                    if (!(ContentType.none != h2.b)) {
                        listIterator.set(null);
                    }
                }
                e a4 = g(eVar).a(str2);
                if (a4 != null) {
                    ArrayList arrayList = (ArrayList) e(list, a4, kVar, eVar);
                    if (arrayList.size() > 0 && ((t) arrayList.get(0)).j("xmlns")) {
                        eVar.f7211m.pop();
                    }
                    listIterator.set(null);
                    for (int size = arrayList.size() - 1; size >= 0; size--) {
                        t tVar = (t) arrayList.get(size);
                        if (size > 0 && h2 != null) {
                            if (h2.f7257h.contains(tVar.b())) {
                                t l2 = tVar.l();
                                l2.f7270h = true;
                                listIterator.add(l2);
                                listIterator.previous();
                            }
                        }
                    }
                    if (!f(eVar).a.isEmpty()) {
                        while (a4.a < f(eVar).a()) {
                            f(eVar).b();
                        }
                    }
                    while (!f(eVar).a.isEmpty() && str2.equals(f(eVar).b.peek().b) && a4.a == f(eVar).a()) {
                        if (list.get(f(eVar).a.peek().a) != null) {
                            int i2 = f(eVar).b().a;
                            Object obj = list.get(i2);
                            if (obj instanceof t) {
                                t tVar2 = (t) obj;
                                t l3 = tVar2.l();
                                l3.f7270h = true;
                                l3.m("id");
                                listIterator.add(l3);
                                d g2 = g(eVar);
                                String b2 = tVar2.b();
                                e eVar2 = new e(m.this, listIterator.previousIndex(), b2);
                                g2.b = eVar2;
                                g2.a.add(eVar2);
                                g2.c.add(b2);
                            } else if (obj instanceof List) {
                                ArrayList arrayList2 = new ArrayList();
                                for (Object obj2 : (List) obj) {
                                    if (obj2 instanceof t) {
                                        arrayList2.add((t) obj2);
                                    } else if (obj2 instanceof List) {
                                        arrayList2.addAll((List) obj2);
                                    }
                                }
                                Iterator it = arrayList2.iterator();
                                while (it.hasNext()) {
                                    d.e.b bVar = (t) it.next();
                                    if (Thread.currentThread().isInterrupted()) {
                                        return;
                                    }
                                    listIterator.add(bVar);
                                    k(list, list.listIterator(list.size() - 1), eVar);
                                }
                                list.set(i2, null);
                            } else {
                                continue;
                            }
                        } else {
                            f(eVar).b();
                        }
                    }
                } else {
                    continue;
                }
            } else if ((next instanceof t) && !((t) next).f7269g) {
                t tVar3 = (t) next;
                String b3 = tVar3.b();
                s h3 = h(b3, eVar);
                e eVar3 = g(eVar).a.isEmpty() ? null : g(eVar).b;
                s h4 = eVar3 != null ? h(eVar3.b, eVar) : null;
                eVar.f7202d.add(b3);
                if (h3 != null && h3.f7262m != null && !tVar3.j("xmlns")) {
                    eVar.f7211m.push(h3.f7262m);
                }
                Iterator it2 = ((LinkedHashMap) tVar3.g()).keySet().iterator();
                while (it2.hasNext()) {
                    String str3 = (String) it2.next();
                    Iterator it3 = it2;
                    if (str3.toLowerCase().indexOf("xmlns:") != -1) {
                        String str4 = str3.toLowerCase().split("xmlns:")[1];
                        String f2 = tVar3.f(str3);
                        tVar3.e(str4.toLowerCase(), f2);
                        eVar.f7212n.put(str4.toLowerCase(), f2);
                    }
                    it2 = it3;
                }
                if (tVar3.j("xmlns")) {
                    String f3 = tVar3.f("xmlns");
                    if (f3.equals("https://www.w3.org/1999/xhtml") || f3.equals("http://w3.org/1999/xhtml")) {
                        Map<String, String> g3 = tVar3.g();
                        g3.put("xmlns", "http://www.w3.org/1999/xhtml");
                        tVar3.p(g3);
                        f3 = "http://www.w3.org/1999/xhtml";
                    }
                    if ("html".equals(b3) && f3.equals("http://www.w3.org/TR/REC-html40")) {
                        tVar3.m("xmlns");
                    } else if (f3.trim().isEmpty()) {
                        tVar3.m("xmlns");
                    } else {
                        eVar.f7211m.push(f3);
                        tVar3.e("", f3);
                        eVar.f7212n.put("", f3);
                    }
                    if (!this.a.f7218i) {
                        tVar3.m("xmlns");
                    }
                }
                if (i(b3, eVar)) {
                    tVar3.q(true);
                } else {
                    tVar3.q(false);
                }
                String b4 = tVar3.b();
                if ("html".equals(b4)) {
                    a(eVar.f7204f, tVar3.g());
                    listIterator.set(null);
                } else if ("body".equals(b4)) {
                    eVar.b = true;
                    a(eVar.f7205g, tVar3.g());
                    listIterator.set(null);
                } else if ("head".equals(b4)) {
                    eVar.a = true;
                    a(eVar.f7206h, tVar3.g());
                    listIterator.set(null);
                } else {
                    if (h3 == null) {
                        Objects.requireNonNull(this.a);
                    }
                    if (h3 != null && h3.f7263n) {
                        Objects.requireNonNull(this.a);
                    }
                    if (h3 == null && h4 != null && !h4.a()) {
                        e(list, eVar3, tVar3, eVar);
                        listIterator.previous();
                    } else if (h3 != null && h3.f7264o && g(eVar).c.contains(b4)) {
                        listIterator.set(null);
                        this.a.c(true, tVar3, ErrorType.UniqueTagDuplicated);
                    } else {
                        boolean z3 = true;
                        if (!z3) {
                            listIterator.set(null);
                            this.a.c(true, tVar3, ErrorType.FatalTagMissing);
                        } else {
                            if (h3 != null && !h3.f7259j.isEmpty()) {
                                int i3 = -1;
                                for (String str5 : h3.f7260k) {
                                    if (str5 != null && (a3 = g(eVar).a(str5)) != null) {
                                        i3 = a3.a;
                                    }
                                }
                                while (true) {
                                    z2 = true;
                                    for (String str6 : h3.f7259j) {
                                        if (str6 != null && (a2 = g(eVar).a(str6)) != null) {
                                            if (a2.a <= i3) {
                                                break;
                                            }
                                            z2 = false;
                                        }
                                    }
                                }
                                if (z2) {
                                    ListIterator<e> listIterator2 = g(eVar).a.listIterator(g(eVar).a.size());
                                    while (true) {
                                        if (!listIterator2.hasPrevious()) {
                                            break;
                                        }
                                        e previous = listIterator2.previous();
                                        if (!Thread.currentThread().isInterrupted()) {
                                            if (h3.f7253d.contains(previous.b)) {
                                            }
                                        }
                                        if (z) {
                                            t m2 = m(h3.f7259j.iterator().next());
                                            if (j(m2, eVar)) {
                                                m2.f7270h = true;
                                                listIterator.previous();
                                                listIterator.add(m2);
                                                listIterator.previous();
                                                this.a.c(true, tVar3, ErrorType.RequiredParentMissing);
                                            } else {
                                                n(list, next, eVar);
                                                listIterator.set(null);
                                            }
                                        } else {
                                            if (h3 != null && eVar3 != null) {
                                                if (h4 != null && (h3.c.contains(h4.a) || h4.b == ContentType.text)) {
                                                    b f4 = f(eVar);
                                                    e eVar4 = new e(this, listIterator.previousIndex(), h3.a);
                                                    f4.a.add(eVar3);
                                                    f4.b.add(eVar4);
                                                    this.a.c(!tVar3.j("id"), (t) list.get(eVar3.a), ErrorType.UnpermittedChild);
                                                    ArrayList arrayList3 = (ArrayList) e(list, eVar3, tVar3, eVar);
                                                    int size2 = arrayList3.size();
                                                    if ((!h3.f7256g.isEmpty()) && size2 > 0) {
                                                        ListIterator listIterator3 = arrayList3.listIterator(size2);
                                                        ArrayList arrayList4 = new ArrayList();
                                                        while (listIterator3.hasPrevious()) {
                                                            if (Thread.currentThread().isInterrupted()) {
                                                                return;
                                                            }
                                                            t tVar4 = (t) listIterator3.previous();
                                                            if (!h3.f7256g.contains(tVar4.b())) {
                                                                break;
                                                            }
                                                            arrayList4.add(0, tVar4);
                                                        }
                                                        if (arrayList4.size() > 0) {
                                                            Iterator it4 = arrayList4.iterator();
                                                            while (it4.hasNext()) {
                                                                if (Thread.currentThread().isInterrupted()) {
                                                                    return;
                                                                }
                                                                t tVar5 = (t) it4.next();
                                                                int i4 = 0;
                                                                int i5 = 0;
                                                                while (listIterator.hasNext() && i4 < 3) {
                                                                    d.e.b next2 = listIterator.next();
                                                                    i4++;
                                                                    if (!(next2 instanceof t)) {
                                                                        break;
                                                                    }
                                                                    t tVar6 = (t) next2;
                                                                    if (!tVar6.f7275m) {
                                                                        break;
                                                                    }
                                                                    if (!(tVar6.a.equals(tVar5.a) && tVar6.g().equals(tVar5.g()))) {
                                                                        break;
                                                                    }
                                                                    i5++;
                                                                }
                                                                for (int i6 = 0; i6 < i4; i6++) {
                                                                    listIterator.previous();
                                                                }
                                                                if (!(i5 == 3)) {
                                                                    listIterator.add(tVar5.l());
                                                                } else {
                                                                    it4.remove();
                                                                }
                                                            }
                                                            for (int i7 = 0; i7 < arrayList4.size(); i7++) {
                                                                listIterator.previous();
                                                            }
                                                        }
                                                    }
                                                    listIterator.previous();
                                                }
                                            }
                                            if (!j(next, eVar)) {
                                                e eVar5 = g(eVar).b;
                                                if (eVar5 != null && (sVar = eVar5.c) != null && (str = sVar.f7261l) != null) {
                                                    t m3 = m(str);
                                                    if (j(m3, eVar) && h(eVar5.c.f7261l, eVar) != null && h(eVar5.c.f7261l, eVar).b(next)) {
                                                        m3.f7270h = true;
                                                        listIterator.previous();
                                                        listIterator.add(m3);
                                                        listIterator.previous();
                                                        this.a.c(true, tVar3, ErrorType.RequiredParentMissing);
                                                    } else {
                                                        n(list, next, eVar);
                                                        listIterator.set(null);
                                                    }
                                                } else {
                                                    n(list, next, eVar);
                                                    listIterator.set(null);
                                                }
                                            } else {
                                                if (h3 != null) {
                                                    if (!(ContentType.none != h3.b)) {
                                                        tVar3.f7269g = true;
                                                        b(h3, tVar3, eVar);
                                                        listIterator.set(tVar3);
                                                    }
                                                }
                                                d g4 = g(eVar);
                                                e eVar6 = new e(m.this, listIterator.previousIndex(), b4);
                                                g4.b = eVar6;
                                                g4.a.add(eVar6);
                                                g4.c.add(b4);
                                            }
                                        }
                                    }
                                    z = true;
                                    if (z) {
                                    }
                                }
                            }
                            z = false;
                            if (z) {
                            }
                        }
                    }
                }
            } else {
                if (eVar.a && !eVar.b && this.a.f7220k) {
                    if (next instanceof h) {
                        if (g(eVar).b == null) {
                            eVar.c.add(new p((h) next, eVar.f7205g));
                        }
                    } else if (next instanceof i) {
                        i iVar = (i) next;
                        if (iVar.b && ((d.e.b) list.get(list.size() - 1)) == next) {
                            eVar.c.add(new p(iVar, eVar.f7205g));
                        }
                    }
                }
                if (!j(next, eVar)) {
                    n(list, next, eVar);
                    listIterator.set(null);
                }
            }
        }
    }

    public final boolean l(List list, d.e.e eVar) {
        boolean z;
        boolean z2 = false;
        for (Object obj : list) {
            if ((obj instanceof t) && !eVar.f7209k.contains(obj)) {
                t tVar = (t) obj;
                Set<d.e.y.a> set = eVar.f7208j;
                if (set != null) {
                    for (d.e.y.a aVar : set) {
                        if (aVar.a(tVar)) {
                            tVar.f7274l = true;
                            eVar.f7209k.add(tVar);
                            this.a.a(aVar, tVar);
                            break;
                        }
                    }
                }
                Set<d.e.y.a> set2 = eVar.f7210l;
                if (set2 == null || set2.isEmpty()) {
                    z = false;
                    if (!z) {
                        z2 = true;
                    } else if (!tVar.k()) {
                        z2 |= l(tVar.f7266d, eVar);
                    }
                } else {
                    for (d.e.y.a aVar2 : eVar.f7210l) {
                        if (aVar2.a(tVar)) {
                            z = false;
                            break;
                        }
                    }
                    if (!tVar.f7270h) {
                        this.a.b(true, tVar, ErrorType.NotAllowedTag);
                    }
                    tVar.f7274l = true;
                    eVar.f7209k.add(tVar);
                    z = true;
                    if (!z) {
                    }
                }
            }
        }
        return z2;
    }

    public final t m(String str) {
        return new t(str, false);
    }

    public final void n(List list, Object obj, d.e.e eVar) {
        t tVar;
        s sVar;
        e eVar2 = g(eVar).b;
        if (eVar2 == null || (sVar = eVar2.c) == null || !sVar.f7265p) {
            d g2 = g(eVar);
            e eVar3 = null;
            if (!g2.a.isEmpty()) {
                List<e> list2 = g2.a;
                ListIterator<e> listIterator = list2.listIterator(list2.size());
                e eVar4 = null;
                while (listIterator.hasPrevious()) {
                    if (Thread.currentThread().isInterrupted()) {
                        Objects.requireNonNull(m.this);
                        break;
                    }
                    e previous = listIterator.previous();
                    s sVar2 = previous.c;
                    if ((sVar2 == null || sVar2.a()) && eVar4 != null) {
                        break;
                    }
                    eVar4 = previous;
                }
                eVar3 = eVar4;
            }
            if (eVar3 == null || (tVar = (t) list.get(eVar3.a)) == null) {
                return;
            }
            if (tVar.f7267e == null) {
                tVar.f7267e = new ArrayList();
            }
            if (obj instanceof d.e.b) {
                tVar.f7267e.add((d.e.b) obj);
                return;
            }
            StringBuilder J = i.a.b.a.a.J("Attempt to add invalid item for moving; class=");
            J.append(obj.getClass());
            throw new RuntimeException(J.toString());
        }
    }
}