/*
 * Decompiled with CFR 0.152.
 */
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public final class ke {
    public final int a;
    public final int b;
    public final cn c;
    public final byte d;
    public final int e;

    public final int c() {
        return this.b * 128;
    }

    public final int b() {
        return this.a * 128;
    }

    public final String toString() {
        return "(" + this.a + ", " + this.b + ", " + this.c + ")";
    }

    public final int hashCode() {
        return this.e;
    }

    public static int a(iv iv2, cn cn2) {
        return iv2.a(cn2) / 128;
    }

    public static ke a(DataInput dataInput) {
        try {
            return new ke(dataInput.readByte(), dataInput.readInt(), dataInput.readInt(), cn.b(dataInput.readUnsignedByte()));
        }
        catch (IllegalArgumentException illegalArgumentException) {
            throw new IOException(illegalArgumentException.getMessage());
        }
    }

    public static byte a() {
        if (!lh.r()) {
            return 6;
        }
        return 3;
    }

    public static int b(iv iv2, cn cn2) {
        return iv2.b(cn2) / 128;
    }

    public ke(byte by2, int n, int n2, cn cn2) {
        if (cn2 != null) {
            if ((n %= cn2.a / 128) < 0) {
                n += cn2.a / 128;
            }
            this.d = by2;
            this.a = n;
            this.b = n2;
            this.c = cn2;
            this.e = ((this.a * 29 + this.b) * 29 + this.c.b) * 4 + this.d;
            return;
        }
        throw new IllegalArgumentException("Zoom cannot be null");
    }

    public final boolean d() {
        return this.b < 0 || this.b >= this.c.a / 128;
    }

    public ke(byte by2, ke ke2) {
        this(by2, ke2.a, ke2.b, ke2.c);
    }

    public final ke a(boolean n) {
        cn cn2 = n != 0 ? cn.b(this.c.b - 1) : this.c.b();
        if (cn2 != null) {
            n = this.a;
            int n2 = this.b;
            if (n < 0) {
                --n;
            }
            if (n2 < 0) {
                --n2;
            }
            return new ke(this.d, n / 2, n2 / 2, cn2);
        }
        return null;
    }

    public final void a(DataOutput dataOutput) {
        dataOutput.writeByte(this.d);
        dataOutput.writeInt(this.a);
        dataOutput.writeInt(this.b);
        dataOutput.writeByte(this.c.b);
    }

    public ke(byte by2, iv iv2, cn cn2) {
        this(by2, ke.a(iv2, cn2), ke.b(iv2, cn2), cn2);
    }

    public final boolean equals(Object object) {
        block2: {
            block3: {
                if (this == object) break block2;
                if (!(object instanceof ke)) break block3;
                ke ke2 = (ke)object;
                if (this.a == ke2.a && this.b == ke2.b && this.c == ke2.c && this.d == ke2.d) break block2;
            }
            return false;
        }
        return true;
    }
}

