/*
 * Decompiled with CFR 0.152.
 */
public class hc
extends gm {
    private int g;
    private int h;
    private boolean j;
    public w a;
    public String b;
    public String[] c;
    public int d = -16777216;
    public int e;

    public String toString() {
        return super.toString();
    }

    public final void e() {
        this.l(this.d());
    }

    public final void a(int n) {
        this.g = n;
        this.a();
    }

    public final void b(boolean bl2) {
        this.j = bl2;
        this.a();
    }

    public final void b(ht ht2, int n, int n2) {
        int n3 = ht2.e();
        w w2 = ht2.f();
        this.c(ht2, n, n2);
        ht2.a(n3);
        ht2.a(w2);
    }

    public void a(ht ht2, String string, int n, int n2) {
        ht2.a(this.d);
        ht2.a(this.a);
        int n3 = this.a.t();
        this.a.i(this.d);
        ht2.a(string, n, n2);
        this.a.i(n3);
    }

    public hc(int n, int n2, int n3, w w2, String string, boolean bl2) {
        super(n, n2, n3, w2.l());
        this.a = w2;
        this.g = 1;
        this.j = bl2;
        this.h = w2.l();
        this.a(string);
    }

    public final void a(int n, int n2) {
        if (n != this.r) {
            this.l(Math.min(n, this.h()));
        }
    }

    public final void b(int n, int n2) {
        if (n2 != this.r && (this.g > 1 || this.j)) {
            this.a();
        }
    }

    public final void a(String string) {
        String string2 = this.b;
        this.b = string;
        if (string == null || !string.equals(string2)) {
            this.a();
        }
    }

    public final int i() {
        if (this.g != Integer.MAX_VALUE) {
            return this.g * this.a.l();
        }
        return Integer.MAX_VALUE;
    }

    public final int d() {
        int n = 0;
        for (int i = 0; i < this.c.length; ++i) {
            int n2 = bk.a(this.a, this.c[i], null)[0];
            if (i != 0) {
                // empty if block
            }
            if ((n2 += 0) <= n) continue;
            n = n2;
        }
        return n;
    }

    public final int h() {
        if (this.b != null) {
            int n = 0;
            int n2 = 0;
            while (true) {
                int n3;
                int n4 = (n3 = this.b.indexOf("\n", n)) == -1 ? this.b.length() - n : n3 - n;
                n2 = Math.max(n2, bk.a(this.a, this.b.substring(n, n + n4), null)[0]);
                if (n3 == -1) break;
                n = n3 + 1;
            }
            return n2;
        }
        return 0;
    }

    public void c(ht ht2, int n, int n2) {
        int n3 = n2 + this.s;
        int n4 = 0;
        while (n4 < this.c.length && n2 < n3) {
            int n5;
            int n6;
            switch (this.e) {
                case 1: {
                    n6 = n + (this.r - 0 >> 1) - (this.a.a(this.c[n4]) >> 1);
                    break;
                }
                case 2: {
                    n6 = n + (this.r - 0) - this.a.a(this.c[n4]);
                    break;
                }
                default: {
                    n6 = n;
                }
            }
            if (n4 == 0) {
                switch (this.e) {
                    default: {
                        n5 = n4 + 1;
                        this.a(ht2, this.c[n4], n6 + 0, n2);
                        break;
                    }
                    case 0: {
                        n5 = n4 + 1;
                        this.a(ht2, this.c[n4], n6 + 0 + 0, n2);
                        break;
                    }
                }
            } else {
                n5 = n4 + 1;
                this.a(ht2, this.c[n4], n6, n2);
            }
            n4 = n5;
            n2 += this.h;
        }
    }

    public final void a() {
        String string = this.b != null ? this.b : "";
        if (this.g == 1) {
            if (this.j) {
                int n = this.r - 0;
                if (this.a.a(string) > n) {
                    int n2 = n - this.a.a("...");
                    for (n = 2; n < string.length(); ++n) {
                        if (this.a.a(string, 0, n) <= n2) {
                            continue;
                        }
                        string = string.substring(0, n - 1) + "...";
                        break;
                    }
                }
            }
            this.c = new String[]{string};
        } else {
            this.c = a.a(this.r - 0, this.g, this.a, string, 0, true);
        }
        this.m(this.c.length * this.h);
        this.t();
    }

    public hc(w w2, String string) {
        this.b = string;
        this.c = new String[]{string};
        this.a = w2;
        this.g = Integer.MAX_VALUE;
        this.h = w2.l();
        this.e = 0;
    }

    public hc(int n, int n2, w w2, String string) {
        super(n, n2, w2.a(string), w2.l());
        this.b = string;
        this.c = new String[]{string};
        this.a = w2;
        this.g = 1;
        this.h = w2.l();
        this.e = 0;
    }

    public hc(int n, int n2, int n3, int n4, w w2, String string) {
        super(n, n2, n3, 0);
        this.b = string;
        this.c = a.a(n3, n4, w2, string, 0, true);
        this.m(this.c.length * w2.l());
        this.a = w2;
        this.g = n4;
        this.h = w2.l();
        this.e = 0;
    }

    public hc(int n, int n2, int n3, w w2, String string) {
        super(n, n2, n3, 0);
        this.b = string;
        this.c = a.a(n3, Integer.MAX_VALUE, w2, string, 0, true);
        this.m(this.c.length * w2.l());
        this.a = w2;
        this.g = Integer.MAX_VALUE;
        this.h = w2.l();
        this.e = 0;
    }
}

