/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  javax.microedition.lcdui.Command
 *  javax.microedition.lcdui.CommandListener
 *  javax.microedition.lcdui.Display
 *  javax.microedition.lcdui.Displayable
 *  javax.microedition.lcdui.TextBox
 */
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Vector;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.TextBox;

/*
 * Duplicate member names - consider using --renamedupmembers true
 */
public final class bq
implements jf,
Runnable,
CommandListener,
pf {
    private final ek b;
    private final cq e;
    private final cq f;
    private final ck f;
    private final Command g;
    private final Command h;
    private final Display m;
    public final Vector b;
    public final byte c;
    private hj a;
    private nj a;
    private mt b;
    private ic b;
    private nj b;
    private nj c;
    private TextBox c;
    private Vector d;
    private Displayable d;
    private ek e;
    private ek f;
    private ek g;
    private ek h;
    private int i;
    private ek i;
    private bj j;
    private int j;
    private String l;
    private long n;
    public Vector c;
    public String k;

    public void a(mt mt2) {
        this.b = mt2;
    }

    /*
     * Enabled aggressive block sorting
     */
    public boolean a(DataInput dataInput) {
        lk lk2 = ar.a(la.ab, dataInput);
        int n = ar.b(lk2, 1, -1);
        int n2 = ar.b(lk2.f(2), 1, -1);
        switch (n) {
            default: {
                if (this.j != null) {
                    this.a.a(new mg(this));
                }
                ka.a(n2, this.a);
                return true;
            }
            case 0: {
                if (this.j == null) return true;
                this.a.a(new ly(this));
                return true;
            }
        }
    }

    public boolean A_() {
        return false;
    }

    public boolean z_() {
        return true;
    }

    public boolean y_() {
        return true;
    }

    public int z() {
        return 47;
    }

    public int b() {
        return this.d.indexOf(this.b);
    }

    public ic a(int n) {
        return (ic)this.d.elementAt(n);
    }

    private void a(Exception exception) {
        me.b("REQUEST", exception);
        this.f.s();
        this.f.c(0);
    }

    private static int a(int n, int n2, nj nj2) {
        return Math.max(Math.abs(n - nj2.a), Math.abs(n2 - nj2.b));
    }

    private static int c(int n) {
        int n2 = 0;
        if ((n & 1) == 0) {
            if ((n & 2) == 0) {
                if ((n & 4) == 0) {
                    if ((n & 8) == 0) {
                        if ((n & 0x10) == 0) {
                            if ((n & 0x20) != 0) {
                                n2 = 5;
                            }
                        } else {
                            n2 = 4;
                        }
                    } else {
                        n2 = 3;
                    }
                } else {
                    n2 = 2;
                }
            } else {
                n2 = 1;
            }
        } else {
            n2 = 0;
        }
        if ((n & 0x10000) != 0) {
            n2 |= 0x10000;
        }
        if ((n & 0x40000) != 0) {
            n2 |= 0x40000;
        }
        if ((n & 0x80000) != 0) {
            n2 |= 0x80000;
        }
        if ((n & 0x200000) == 0) {
            return n2;
        }
        return n2 | 0x200000;
    }

    private int c() {
        if (this.j == -1) {
            return 100;
        }
        return this.j;
    }

    private static int a(String string) {
        if (string != null) {
            try {
                return Integer.parseInt(string);
            }
            catch (NumberFormatException numberFormatException) {}
        }
        return -1;
    }

    public static bj a(bq bq2) {
        return bq2.j;
    }

    public String b() {
        return this.l;
    }

    public bq(boolean bl2, boolean bl3) {
    }

    public bq() {
    }

    public void b() {
        this.c();
    }

    public void e() {
        this.d = new Vector();
        this.b = null;
    }

    public bq(boolean bl2) {
        this.d = new Vector();
        this.b = null;
    }

    public bq(ck ck2, String string, Vector vector, byte by2) {
        this.f = ck2;
        this.c = new Vector();
        this.k = string;
        this.b = vector;
        this.c = by2;
    }

    public bq(Display display, mt mt2, String string, cq cq2, cq cq3) {
        this.l = "";
        this.m = display;
        this.b = mt2;
        this.k = string;
        this.e = cq2;
        this.f = cq3;
        this.j = 100;
        this.g = new Command(cq2.g, 4, cq2.i);
        this.h = new Command(cq3.g, 3, cq3.i);
    }

    public bq(ek ek2, Vector vector, Vector vector2, ek ek3, ek ek4, ek ek5, ek ek6, ek ek7, hj hj2, bj bj2) {
        this.b = ek2;
        this.c = vector;
        this.d = vector2;
        this.e = ek3;
        this.f = ek4;
        this.g = ek5;
        this.h = ek6;
        this.i = ek7;
        this.a = hj2;
        this.j = bj2;
    }

    public void b(ic ic2) {
        if (this.d.contains(ic2)) {
            if (this.b != null) {
                this.b.s();
            }
            this.b = ic2;
        }
    }

    public void a(String string) {
        this.l = string;
        if (this.c != null) {
            this.c.setString(this.l);
        }
    }

    public void a(ic ic2) {
        this.d.addElement(ic2);
        if (this.d.size() == 1) {
            ic2.q_();
        }
    }

    public void a(jf jf2) {
        this.c.addElement(jf2);
        if (jf2.y_() && !this.f.b()) {
            this.d();
        }
    }

    public boolean a(int n) {
        return this.b.isEmpty() || this.b.contains(new Integer(n));
    }

    public final nj a(int n, int n2, int n3) {
        int n4 = 0;
        long l = System.currentTimeMillis();
        oa oa2 = null;
        if (!(2 != n || this.a != null && this.a.d())) {
            n = 0;
        }
        if (1 == n) {
            boolean bl2 = this.a != null && this.a.a() && l - this.a.c <= (long)325 && bq.a(n2, n3, this.a) <= 25;
            if (bl2) {
                long l2;
                n4 = this.b != null && this.b.g() && this.c != null && (l2 = l - this.c.c) >= (long)100 && l2 <= (long)650 && bq.a(n2, n3, this.c) <= 25 ? 1 : 0;
                n4 = n4 == 0 ? 1 : 2;
            }
        } else if (2 == n) {
            int n5 = this.a.a - n2;
            int n6 = this.a.b - n3;
            oa2 = new oa(n5, n6);
        }
        nj nj2 = new nj(n, n4, n2, n3, l, oa2);
        if (2 != n) {
            this.c = this.b;
            this.b = this.a;
            this.a = nj2;
        }
        return nj2;
    }

    public ej a() {
        int n = bq.a(System.getProperty("CellID"));
        if (n != -1) {
            int n2 = -1;
            int n3 = bq.a(System.getProperty("LocAreaCode"));
            String string = System.getProperty("IMSI");
            int n4 = -1;
            if (string != null && string.length() >= 6) {
                n4 = bq.a(string.substring(3, 6));
                n2 = bq.a(string.substring(0, 3));
            }
            return ej.a(null, -1, n, n3, -1, -1, -1, n2, n4, -1);
        }
        ej.b();
        return ej.d();
    }

    public void a(DataOutput dataOutput) {
        int n;
        int n2;
        lk lk2 = new lk(la.aa);
        if (this.b != null) {
            n2 = this.b.a;
            for (n = 0; n < n2; ++n) {
                lk2.a(1, this.b.a(n));
            }
        }
        if (this.c != null) {
            n2 = this.c.size();
            for (n = 0; n < n2; ++n) {
                lk2.a(2, (String)this.c.elementAt(n));
            }
        }
        if (this.d != null) {
            n2 = this.d.size();
            for (n = 0; n < n2; ++n) {
                lk2.a(3, (String)this.d.elementAt(n));
            }
        }
        if (this.e != null) {
            n2 = this.e.a;
            for (n = 0; n < n2; ++n) {
                lk2.a(4, this.e.a(n));
            }
        }
        if (this.f != null) {
            n2 = this.f.a;
            for (n = 0; n < n2; ++n) {
                lk2.a(5, this.f.a(n));
            }
        }
        if (this.g != null) {
            n2 = this.g.a;
            for (n = 0; n < n2; ++n) {
                lk2.a(6, this.g.a(n));
            }
        }
        if (this.h != null) {
            n2 = this.h.a;
            for (n = 0; n < n2; ++n) {
                lk2.a(7, this.h.a(n));
            }
        }
        if (this.i != null) {
            n2 = this.i.a;
            for (n = 0; n < n2; ++n) {
                lk2.a(8, this.i.a(n));
            }
        }
        dataOutput.writeInt(lk2.b());
        lk2.a((OutputStream)((Object)dataOutput));
    }

    public void a(int n) {
        if (this.c != null && n != this.j) {
            TextBox textBox = this.c;
            int n2 = n == -1 ? 100 : n;
            textBox.setMaxSize(n2);
        }
        this.j = n;
    }

    public void b(int n) {
        if (this.c != null && (n & 0xFFFF) != this.c.getConstraints()) {
            this.c = null;
        }
        this.i = n;
    }

    public void a() {
        if (!false) {
            Displayable displayable = this.m.getCurrent();
            if (displayable != this.c) {
                this.d = displayable;
            }
            this.n = System.currentTimeMillis();
            if (this.c == null) {
                this.c = new TextBox(this.k, this.l, this.c(), bq.c(this.i));
                this.c.addCommand(this.g);
                this.c.addCommand(this.h);
                this.c.setCommandListener((CommandListener)this);
            }
            this.m.setCurrent((Displayable)this.c);
        }
    }

    public void commandAction(Command command, Displayable object) {
        if (System.currentTimeMillis() > this.n + (long)1000) {
            if (command == this.g) {
                this.l = ed.c(this.c.getString());
                this.l = this.l.replace('\u2029', '\n');
            } else {
                this.c.setString(this.l);
            }
            this.m.setCurrent(this.d);
            object = this.b;
            cq cq2 = command == this.h ? this.f : this.e;
            object.a(cq2, this);
        }
    }

    public void c() {
        int n;
        block10: {
            if (!this.f.b()) {
                block9: {
                    Vector vector = this.c;
                    synchronized (vector) {
                        block8: {
                            for (n = 0; n < this.c.size(); ++n) {
                                if (!((jf)this.c.elementAt(n)).y_()) {
                                    continue;
                                }
                                break block8;
                            }
                            break block9;
                        }
                        n = 1;
                        break block10;
                    }
                }
                n = 0;
            } else {
                n = 0;
            }
        }
        if (n != 0) {
            this.d();
        }
    }

    /*
     * Exception decompiling
     */
    private synchronized void d() {
        /*
         * This method has failed to decompile.  When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
         * 
         * org.benf.cfr.reader.util.ConfusedCFRException: Back jump on a try block [egrp 0[TRYBLOCK] [2 : 25->152)] java.lang.Throwable
         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.Op02WithProcessedDataAndRefs.insertExceptionBlocks(Op02WithProcessedDataAndRefs.java:2283)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:415)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
         *     at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
         *     at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
         *     at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
         *     at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
         *     at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
         *     at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
         *     at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
         *     at org.benf.cfr.reader.Main.main(Main.java:54)
         */
        throw new IllegalStateException("Decompilation failed");
    }

    /*
     * Unable to fully structure code
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     * Converted monitor instructions to comments
     * Lifted jumps to return sites
     */
    public void run() {
        block30: {
            var2_1 = ck.a(this.f);
            // MONITORENTER : var2_1
            var5_2 = this.d;
            this.d = null;
            System.currentTimeMillis();
            ck.a(this.f).notifyAll();
            // MONITOREXIT : var2_1
            var4_3 = false;
            var3_4 = false;
            if (true) ** GOTO lbl58
            while (true) {
                if (ck.e(this.f) > 0L) {
                    try {
                        this.wait(ck.e(this.f));
                    }
                    catch (InterruptedException v0) {}
                }
                {
                    try {
                        var6_9 = var3_4 = ck.a(var5_2);
                        var7_10 = var4_3 = ck.b(var5_2);
                        this.f.a(var5_2, this);
                        this.f.p.a(false);
                        ck.f(this.f);
                    }
                    catch (Throwable v1) {
                        var3_4 = var6_9;
                        var4_3 = var7_10;
                        break;
                    }
                    catch (OutOfMemoryError v2) {
                        var3_4 = var6_9;
                        var4_3 = var7_10;
                        nz.a();
                        ck.a(this.f, 5);
                    }
                    catch (Exception var1_5) {
                        var3_4 = var6_9;
                        var4_3 = var7_10;
                        ck.a(this.f, 5);
                        me.a("REQUEST", var1_5);
                    }
                    catch (IOException var8_11) {
                        var3_4 = var6_9;
                        var4_3 = var7_10;
                        if (!ck.a(var8_11)) {
                            ck.a(this.f, 3);
                        } else {
                            this.a(var8_11);
                        }
                    }
                    catch (SecurityException var9_12) {
                        var3_4 = var6_9;
                        var4_3 = var7_10;
                        this.a(var9_12);
                    }
lbl58:
                    // 7 sources

                    var3_4 = var6_9 = var3_4;
                    var4_3 = var7_10 = var4_3;
                    if (this.f.c && var5_2.size() > 0) {
                        // MONITORENTER : this
                        continue;
                    }
                    break block30;
                }
                break;
            }
            var2_1 = ck.a(this.f);
            // MONITORENTER : var2_1
            ck.g(this.f);
            if (var3_4) {
                ck.h(this.f);
            }
            if (var4_3) {
                ck.i(this.f);
            }
            // MONITOREXIT : var2_1
            this.c();
            throw var1_7;
        }
        var2_1 = ck.a(this.f);
        // MONITORENTER : var2_1
        ck.g(this.f);
        if (var6_9) {
            ck.h(this.f);
        }
        if (var7_10) {
            ck.i(this.f);
        }
        // MONITOREXIT : var2_1
        this.c();
    }
}

