/*
 * Decompiled with CFR 0.152.
 */
import java.util.Hashtable;
import java.util.Vector;

/*
 * Duplicate member names - consider using --renamedupmembers true
 */
public final class hm
extends gm {
    private final int h;
    private final int j;
    private final Vector k;
    private final Vector l;
    private final Hashtable m;
    private String i;
    private int k;
    private int l;
    private int m;
    private int n = -3618616;
    private int o = -4860423;
    private boolean w = true;
    public w a;
    public w b;
    public int c = 0xFFFFFF;
    public int d = -11842741;
    public int e = -16777216;
    public int f = -1;
    public int g;

    public final void b(boolean bl2) {
    }

    public final boolean b() {
        return true;
    }

    public final int d() {
        return this.k.size();
    }

    public final void a(cq cq2, Character c, int n) {
        this.k.insertElementAt(cq2, n);
        this.l.insertElementAt(c, n);
        if (n < this.g && this.d() > 0) {
            ++this.g;
        }
        this.m(this.a.l() + this.h + this.s);
        this.j();
        n = this.a.a(this.a(n)) + this.j + 8;
        if (this.r < n) {
            this.l(n);
            this.f();
        }
    }

    public final void b(ht ht2, int n, int n2) {
        w w2 = ht2.f();
        int n3 = ht2.e();
        ht2.a(this.c);
        ht2.c(n, n2, this.r, this.s);
        ht2.a(this.d);
        int n4 = n + 4;
        ht2.d(n, n2, this.r - 1, this.s - 1);
        n2 += this.s;
        n = this.d();
        while (true) {
            int n5;
            int n6 = n;
            n = n6 + -1;
            if (n6 == 0) break;
            String string = this.a(n);
            w w3 = n != this.g ? this.a : this.b;
            n2 -= w3.l() + this.h;
            if (n == this.g) {
                if (!this.w) {
                    ht2.a(this.o);
                    ht2.c(n4 - 4 + 1, n2 - (this.h >> 1) + 1, this.r - 2, this.a.l() + this.h - 2);
                } else {
                    a.d(ht2, n4 - 4 + 1, n2 - (this.h >> 1), this.r - 2, this.a.l() + this.h);
                }
                n5 = this.f;
            } else {
                n5 = this.c(n) ? this.e : this.n;
            }
            ht2.a(n5);
            ht2.a(w3);
            ht2.a(string, n4, n2);
            n5 = n4 + this.r - 8 - this.j;
            Character c = (Character)this.l.elementAt(n);
            if (c == null) continue;
            this.a.a(ht2, '\u0001' + c.toString(), n5 + 4, n2);
        }
        ht2.a(n3);
        ht2.a(w2);
    }

    /*
     * Enabled aggressive block sorting
     * Lifted jumps to return sites
     */
    public final int a(pb pb2) {
        int n;
        block11: {
            switch (pb2.c) {
                case 7: {
                    this.b(true);
                    return -3;
                }
                case 8: {
                    this.b(false);
                    return -2;
                }
                case 2: 
                case 10: {
                    int n2 = this.g;
                    do {
                        int n3 = this.g >= this.d() - 1 ? 0 : this.g + 1;
                        this.e(n3);
                        if (this.c(this.g)) return -2;
                    } while (this.g != n2);
                    return -2;
                }
                case 1: 
                case 9: {
                    int n4 = this.g;
                    do {
                        int n5 = this.g <= 0 ? this.d() - 1 : this.g - 1;
                        this.e(n5);
                        if (this.c(this.g)) return -2;
                    } while (this.g != n4);
                    return -2;
                }
            }
            for (n = 0; n < this.l.size(); ++n) {
                Character c = (Character)this.l.elementAt(n);
                if (c == null || c.charValue() != pb2.b) {
                    continue;
                }
                break block11;
            }
            n = -1;
        }
        if (n == -1) {
            return super.a(pb2);
        }
        this.e(n);
        return -3;
    }

    public final int b(nj nj2, int n, int n2) {
        if (this.t && n >= 0 && n < this.r) {
            n = this.s;
            n = n2 >= 0 && n2 < n ? (n2 << 8) / ((n << 16) / (this.d() << 8)) : -1;
            if (n >= 0) {
                this.e(n);
                if (nj2.j()) {
                    this.b(true);
                    return -3;
                }
                return -2;
            }
        }
        return -1;
    }

    public final boolean c(int n) {
        return !this.m.containsKey(this.g(n));
    }

    public final void e(int n) {
        if (this.g != n) {
            this.g = n;
            this.t();
        }
    }

    public final void a(cq cq2) {
        if (this.k.indexOf(cq2) != -1) {
            this.m.put(cq2, cq2);
        }
    }

    public final void a(cq cq2, cq cq3) {
        int n = this.k.indexOf(cq2);
        if (n != -1) {
            this.k.removeElementAt(n);
            this.k.insertElementAt(cq3, n);
            this.m.remove(cq2);
        }
    }

    public final void b(cq cq2) {
        this.m.remove(cq2);
    }

    private cq g(int n) {
        return (cq)this.k.elementAt(n);
    }

    public final String a(int n) {
        return this.g((int)n).g;
    }

    public final cq f() {
        return this.g(this.g);
    }

    private void f() {
        if ((this.k & 4) == 0) {
            if ((this.k & 2) != 0) {
                this.j(this.l - (this.r >> 1));
                return;
            }
            this.j(this.l);
            return;
        }
        this.j(this.l - this.r);
    }

    private void j() {
        if ((this.k & 0x20) == 0) {
            if ((this.k & 0x10) != 0) {
                this.k(this.m - (this.s >> 1));
                return;
            }
            this.k(this.m);
            return;
        }
        this.k(this.m - this.s);
    }

    public hm(w w2, String string, w w3, int n, int n2, int n3, int n4) {
        this.i = string;
        this.a = w3;
        this.b = w3;
        this.m = n3;
        this.l = n2;
        this.k = n;
        this.h = n4;
        this.m(n4);
        this.f();
        this.j();
    }

    public hm(w w2, String string, w w3, int n, int n2, int n3, int n4, int n5) {
        this(w2, string, w3, n3, n2, n, n4);
        this.k = new Vector();
        this.l = new Vector();
        this.m = new Hashtable();
        this.j = n5;
    }
}

