/*
 * Decompiled with CFR 0.152.
 */
public final class ds
extends ep
implements nf {
    private static volatile boolean p;
    private static final int j;
    private final fe I;
    private final fe J;
    private final fe K;
    private final ck k;
    private final gd l;
    private final lh m;
    private final w n;
    private final int o;
    private final u u = u.a();
    private ij[] A;
    private String B;
    private int C;
    private String D;
    private int E;
    private int G;
    private nj v;
    private int w;
    private iv x = null;
    private String y = null;
    private int z;
    public fo a;
    public ft b;
    public boolean c;
    public boolean d;
    public boolean e;
    public le f;
    public int g;
    public boolean h;
    public boolean i;

    public static boolean m() {
        return p;
    }

    public final boolean n_() {
        return !this.c && this.i;
    }

    private boolean t() {
        return this.w == 2;
    }

    private static boolean d(pb pb2) {
        return pb2.c == 4;
    }

    private static boolean c(pb pb2) {
        return pb2.c == 3;
    }

    public final int a(nj nj2) {
        block13: {
            int n;
            block15: {
                block16: {
                    block14: {
                        if (this.c) break block13;
                        if (!this.e) break block14;
                        if (this.J != null && this.I != null && this.K != null) {
                            if (this.J.b(nj2) != 3) {
                                if (this.I.b(nj2) != 3) {
                                    n = this.K.b(nj2) != 3 ? 4 : 12;
                                } else {
                                    this.b(true);
                                    n = 3;
                                }
                            } else {
                                this.b(false);
                                n = 3;
                            }
                        } else {
                            n = 4;
                        }
                        if (n != 4) break block15;
                        n = !this.n_() ? (int)(this.b.g(nj2.a - this.b.p, nj2.b - this.b.q) ? 1 : 0) : 1;
                        if (n == 0) break block14;
                        if (nj2.a()) break block16;
                        if (nj2.c()) {
                            if (this.v != null) {
                                int n2 = this.v.a - nj2.a;
                                n = this.i ? this.a.d : this.a.b;
                                this.a.b(n2 * 16384 / n);
                            }
                            this.v = nj2;
                            return 4;
                        }
                        if (nj2.h()) {
                            this.b(true);
                            return 3;
                        }
                        if (nj2.j()) {
                            this.v = null;
                        }
                    }
                    return 4;
                }
                this.v = nj2;
                return 3;
            }
            return n;
        }
        return 1;
    }

    /*
     * Unable to fully structure code
     */
    public final int a(pb var1_1) {
        block3: {
            block4: {
                block5: {
                    block6: {
                        block7: {
                            block9: {
                                block10: {
                                    block11: {
                                        block12: {
                                            block8: {
                                                ps.b(false);
                                                if (this.c) break block3;
                                                if (var1_1.c == 12) break block4;
                                                var2_2 = jy.b.equals(this.d()) != false && var1_1.c == 8;
                                                if (var2_2) break block3;
                                                var2_2 = jy.o.equals(this.e()) != false && var1_1.c == 6;
                                                if (var2_2) break block5;
                                                if (var1_1.e) break block6;
                                                var2_2 = var1_1.b() == '#';
                                                if (var2_2) break block7;
                                                if (!this.e) break block8;
                                                var2_2 = jy.g.equals(this.d()) != false && var1_1.c == 8 ? true : jy.n.equals(this.e()) != false && var1_1.c == 6;
                                                if (var2_2) break block9;
                                                if (ds.c(var1_1)) break block10;
                                                if (ds.d(var1_1)) break block11;
                                                var2_2 = var1_1.c == 1 || this.a.a() != false && (var2_2 = var1_1.b() == '6') != false;
                                                if (!var2_2) {
                                                    var2_2 = var1_1.c == 2 || this.a.a() != false && (var2_2 = var1_1.b() == '4') != false;
                                                    if (var2_2) {
                                                        this.b(false);
                                                        return 3;
                                                    } else {
                                                        ** GOTO lbl23
                                                    }
                                                }
                                                break block12;
                                            }
                                            if (!this.i) {
                                                return 11;
                                            }
                                            break block6;
                                        }
                                        this.b(true);
                                        return 3;
                                    }
                                    this.a.a(1);
                                    return 3;
                                }
                                this.a.a(-1);
                                return 3;
                            }
                            var3_3 = this.a;
                            var2_2 = this.a.f == false;
                            var3_3.d(var2_2);
                            return 3;
                        }
                        return 12;
                    }
                    return 4;
                }
                ps.b(true);
                return 14;
            }
            return 9;
        }
        return 1;
    }

    public final void a(ht ht2) {
        if (!this.c) {
            int n;
            int n2;
            int n3;
            int n4;
            int n5;
            int n6;
            int n7;
            ++this.G;
            ps ps2 = ps.a();
            if (!this.i) {
                n7 = this.a.b;
                n6 = this.a.c;
                n5 = this.b.p + (this.b.r - n7 >> 1);
                n4 = this.b.q + (this.b.s - n6 >> 1);
                n3 = n4 + 1;
                n2 = ps2.a >> 1;
                n = ps2.b >> 1;
                this.s.a(ht2, n2, n, gu.f(this.g));
                this.b.a(ht2, 0, 0);
            } else {
                n4 = 0;
                n7 = this.a.d;
                n6 = this.a.e;
                n3 = j;
                n5 = 0;
                ht2.a(0);
                ht2.c(0, 0, ps2.a, ps2.b);
            }
            if (this.f != null) {
                ht2.a(this.f, n5, n4);
            }
            if (this.a.a() && lh.t()) {
                this.I.a(ht2, 0, 0);
                this.J.a(ht2, 0, 0);
                this.K.a(ht2, 0, 0);
            }
            n2 = n7 - 4;
            String string = this.a.b();
            n = n5 + 2;
            if (!ed.b(string)) {
                if (!string.equals(this.D) || n2 != this.E) {
                    this.B = a.a(string, this.n, n2, true, "...");
                    this.C = this.n.a(this.B);
                    this.D = string;
                    this.E = n2;
                }
                n2 = n + (n2 - this.C >> 1);
                ht2.a(this.n);
                ht2.a(0);
                ht2.a(this.B, n2 + 1, n3 + 1);
                ht2.a(0xFFFFFF);
                ht2.a(this.B, n2, n3);
            }
            this.a.a(ht2, n5, n4, n7, n6, this.i, this.g, this.h);
            if (this.a.e()) {
                n5 = ps2.a / 2;
                n3 = n3 + this.o + 2;
                this.s.a(ht2, n5 -= this.s.r() / 2, n3);
            }
            this.m.b(this.a.c());
            return;
        }
        this.o();
        return;
        finally {
            this.a.j();
            this.d = false;
        }
    }

    private void w() {
        if (!this.c) {
            int n = this.s.a;
            int n2 = this.s.b;
            int n3 = n > n2 ? 1 : 0;
            n3 = n3 == 0 ? ps.d : 0;
            int n4 = n - ps.c * 2;
            int n5 = n2 / 2 - n3 + ps.q() - 4;
            int n6 = n5 * 1777777 / 1000000;
            if (n6 > n4) {
                n6 = n4;
                n5 = n4 * 1000000 / 1777777;
            }
            this.b = new ft((this.s.a - (n6 &= 0xFFFFFFFE)) / 2, n3, n6, n5 & 0xFFFFFFFE, true);
            this.b.d(n / 2 + ps.p(), n2 / 2 + ps.q());
            this.a.a(this.b.x_() - 2, this.b.c() - 2, n, n2);
            if (lh.t()) {
                this.I.d(this.r(), this.p(), this.s.i(), this.s.h());
                this.J.d(this.q(), this.p(), this.s.i(), this.s.h());
                this.K.d(this.s(), this.p(), this.s.i(), this.s.h());
            }
        }
    }

    public ds(eb eb2, hj hj2, ck ck2, lh lh2, gd gd2) {
        super(eb2, hj2);
        this.k = ck2;
        this.m = lh2;
        this.l = gd2;
        this.n = lh.k().h().a(1, false, false, 0, false);
        this.o = this.n.l();
        lh.k().h().a(1, false, false, 0, false);
        nz.a(this);
        if (lh.t()) {
            this.J = new fe(this.q(), this.p(), '\ued35', '\ued36');
            this.I = new fe(this.r(), this.p(), '\ued33', '\ued34');
            this.K = new fe(this.s(), this.p(), '\ued37', '\ued38');
            return;
        }
        this.K = null;
        this.I = null;
        this.J = null;
    }

    public final void a() {
        int n;
        p = true;
        this.u.b();
        ps.b();
        this.d = false;
        this.e = false;
        this.c = false;
        this.a = this.t() ? new db(this, 130) : new fo(this, 100);
        this.w();
        switch (this.w) {
            case 2: {
                ((db)this.a).a(this.z, this.A);
                break;
            }
            case 1: {
                this.a.a(this.y, this.x);
                break;
            }
            case 0: {
                this.a.a(this.x, this.g);
            }
        }
        this.i = this.a.f;
        if (!this.t() && this.u.j() && this.k.c().b < (n = !this.l.m() ? 18 : 15)) {
            this.l.a(n);
        }
    }

    public final void b() {
        this.u.l();
        p = false;
        if (this.a != null) {
            this.a.g();
            this.a = null;
        }
        this.f = null;
        this.h = false;
        this.x = null;
        this.y = null;
        this.z = -1;
        this.A = null;
        this.m.b((String)null);
        gu.j();
    }

    public final void a(ck ck2) {
        if (ck2 != null) {
            this.e = true;
            iv iv2 = ck2.c;
            this.l.a(iv2);
            ps.a(this.a.i, iv2, this.a.j);
        } else {
            this.m.a(lh.d(506), 2);
            this.c = true;
        }
        this.v();
    }

    public final void a(le le2) {
        this.f = le2;
        this.g = this.a.g;
        this.h = this.a.e(true);
        this.i = this.a.f;
        System.currentTimeMillis();
        ps.a(this.g);
        this.v();
    }

    public final void a(String string) {
        this.c = true;
        this.m.a(string, 0);
        this.v();
    }

    public final void b(String string) {
        this.m.a(string, 2);
    }

    private void b(boolean bl2) {
        this.a.b(bl2);
    }

    public final int b(pb pb2) {
        if (!ds.c(pb2) && !ds.d(pb2)) {
            return 4;
        }
        this.a.a(0);
        return 3;
    }

    private int s() {
        int n = this.s.a;
        if (lh.u()) {
            n -= this.s.i();
        }
        return n - this.s.i();
    }

    private int r() {
        return this.s() - this.s.i();
    }

    private int q() {
        return this.r() - this.s.i();
    }

    private void v() {
        this.d = true;
        this.r.repaint();
    }

    public final void af() {
        if (this.t && this.a != null) {
            this.a.k();
        }
    }

    public final void l_() {
        if (this.a != null) {
            this.a.h();
        }
    }

    public final void m_() {
        if (this.a != null) {
            this.a.i();
        }
    }

    public final void l() {
        if (lh.t()) {
            this.J.a();
            this.I.a();
            this.K.a();
        }
    }

    public final cq e() {
        if (!this.c) {
            if (!this.a.f && this.u.e()) {
                return jy.n;
            }
            return jy.o;
        }
        return null;
    }

    public final cq d() {
        if (!this.c) {
            if (this.a.f) {
                return jy.g;
            }
            return jy.b;
        }
        return jy.b;
    }

    public final boolean a(boolean bl2) {
        return this.d || this.a.e() && this.s.s();
    }

    public final void a(int n, ij[] ijArray) {
        this.w = 2;
        this.z = n;
        this.A = ijArray;
        super.n();
    }

    public final void a(String string, iv iv2) {
        this.w = 1;
        this.x = iv2;
        this.y = string;
        super.n();
    }

    public final void a(iv iv2) {
        this.w = 0;
        this.x = iv2;
        super.n();
    }

    static {
        j = ps.d + 2;
    }

    public final void g_() {
        this.w();
    }

    public final boolean p_() {
        return true;
    }

    private int p() {
        return this.s.b - (this.s.g + this.s.h());
    }
}

