/*
 * Decompiled with CFR 0.152.
 */
import java.io.ByteArrayOutputStream;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Hashtable;

/*
 * Duplicate member names - consider using --renamedupmembers true
 */
public final class ar
extends bj
implements pz {
    private static final char[] a = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
    private Hashtable k;
    public lk a;
    public byte b;
    public dm c;
    public le d;
    public boolean f;

    private static void a(OutputStream outputStream) {
        try {
            outputStream.close();
            return;
        }
        catch (IOException iOException) {
            return;
        }
    }

    public static void b(InputStream inputStream) {
        try {
            if (inputStream != null) {
                inputStream.close();
            }
            return;
        }
        catch (IOException iOException) {
            return;
        }
    }

    public static int a(lk lk2, int n, int n2, int n3) {
        try {
            return ar.b(ar.b(lk2, n), n2, n3);
        }
        catch (ClassCastException | IllegalArgumentException runtimeException) {
            return n3;
        }
    }

    public static String a(lk lk2, int n, int n2) {
        try {
            return ar.a(ar.b(lk2, n), n2);
        }
        catch (ClassCastException classCastException) {
            return "";
        }
    }

    public static long c(lk lk2, int n, int n2) {
        try {
            return ar.e(ar.b(lk2, n), n2);
        }
        catch (ClassCastException classCastException) {
            return -1;
        }
        catch (IllegalArgumentException illegalArgumentException) {
            return -1;
        }
    }

    public static int c(lk lk2, int n) {
        return ar.b(lk2, n, 0);
    }

    public static ar c(DataInput dataInput) {
        String string = dataInput.readUTF();
        iv iv2 = iv.a(dataInput);
        String string2 = dataInput.readUTF();
        String string3 = dataInput.readUTF();
        String string4 = dataInput.readUTF();
        dataInput.readByte();
        dataInput.readUTF();
        dataInput.readUTF();
        new ar(iv2, string, string2, string3, string4, 1).b = (byte)6;
        return new ar(iv2, string, string2, string3, string4, 1);
    }

    public ar(dm dm2, String string, String string2, String string3, String string4, byte by2) {
        this(dm2, string, string2, string3, string4, by2, null, null, null, new gu[0]);
    }

    public ar(dm dm2, String string, byte by2) {
        this(dm2, string, null, null, null, by2);
    }

    public final String[] e() {
        return new String[]{this.a().toString(), this.d()};
    }

    public static byte[] a(String string) {
        byte[] byArray = new byte[ar.a(string, null, 0)];
        ar.a(string, byArray, 0);
        return byArray;
    }

    public final void a(DataOutput dataOutput) {
        dataOutput.writeInt(this.a.b());
        this.a.a((OutputStream)((Object)dataOutput));
    }

    public final void a(int n) {
        this.a.f(110).h(125, n);
    }

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

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

    public final String K() {
        return ar.a(this.a, 90, 93);
    }

    public final String J() {
        return ar.a(this.a, 90, 92);
    }

    public final String H() {
        return ar.a(this.a, 70, 116);
    }

    public final String E() {
        return ar.a(this.a, 70, 72);
    }

    public final String D() {
        return ar.a(this.a, 70, 71);
    }

    public final String G() {
        return ar.a(this.a, 70, 115);
    }

    public final String F() {
        return ar.a(this.a, 70, 73);
    }

    public final String c() {
        return ar.a(4, 1, this.a);
    }

    public final String b() {
        return ar.a(4, 0, this.a);
    }

    public final String d() {
        lk lk2 = this.a;
        return ar.b(ar.a(4, 0, lk2), ar.a(4, 1, lk2));
    }

    public static lk f(lk lk2, int n) {
        lk lk3 = lk2.a(n);
        lk2.a(n, lk3);
        return lk3;
    }

    public static ar a(iv iv2, String string) {
        return new ar(iv2, string, 6);
    }

    public static ar a(lk lk2) {
        return new ar(lk2);
    }

    public final String O() {
        return ar.a(this.ac(), 2);
    }

    public final int P() {
        return ar.c(this.ac(), 9);
    }

    public final String L() {
        return ar.a(this.ac(), 7);
    }

    public final String N() {
        return ar.a(this.ac(), 8);
    }

    public final String U() {
        return this.a.g(124);
    }

    public final String V() {
        return this.a.g(102);
    }

    public final String f() {
        return ar.a(this.a, 11);
    }

    public final String z() {
        return ar.a(this.a, 24);
    }

    public final String y() {
        return ar.a(this.a, 23);
    }

    public final long m() {
        return ar.e(this.a, 119);
    }

    public final byte l() {
        return this.b;
    }

    public final String Q() {
        return this.A();
    }

    public final String h() {
        return ar.b(this.f());
    }

    public final boolean W() {
        return ar.c(this.a);
    }

    /*
     * Enabled aggressive block sorting
     */
    public final boolean i() {
        if (this.t()) {
            if (ed.b(this.K()) && ed.b(this.L()) && ed.b(this.A())) return false;
            return true;
        }
        if (!ed.b(this.A()) || !ed.b(this.y())) return true;
        this.B();
        if (this.B().length <= 0) return false;
        return true;
    }

    public static boolean i(String string) {
        return !ed.b(string) && string.indexOf(".google.") < 15 && string.indexOf("/gmf/") != -1;
    }

    public static String a(int n, int n2, lk lk2) {
        if (lk2.i(n) > n2) {
            return lk2.f(n, n2);
        }
        return "";
    }

    public final String A() {
        if (this.a.i(18) > 0) {
            return this.a.e(18, 0).g(19);
        }
        return "";
    }

    public final boolean g() {
        return 0 == (int)ar.c(this.a, 110, 125);
    }

    public final boolean t() {
        return this.s() || this.r();
    }

    public final iv a() {
        dm dm2 = this.c;
        if (dm2 != null) {
            return dm2.d();
        }
        return null;
    }

    public final void f(String string) {
        if (!ed.b(string)) {
            this.ae().b(7, string);
        }
    }

    public final void g(String string) {
        if (!ed.b(string)) {
            this.ae().b(8, string);
        }
    }

    public final void e(String string) {
        if (!ed.b(string)) {
            this.ae().b(2, string);
        }
    }

    public final void d(String string) {
        if (!ed.b(string)) {
            lk lk2 = new lk(null);
            lk2.b(19, string);
            lk lk3 = lk2;
            this.a.a(18, lk3);
        }
    }

    private static void a(StringBuffer stringBuffer, String string) {
        if (string.length() != 0) {
            char c = stringBuffer.toString().indexOf(63) != -1 ? (char)'&' : '?';
            stringBuffer.append(c).append(string);
        }
    }

    public final String toString() {
        StringBuffer stringBuffer = new StringBuffer();
        iv iv2 = this.a();
        if (iv2 != null) {
            stringBuffer.append(((Object)iv2).toString());
        }
        stringBuffer.append(":");
        stringBuffer.append(this.v());
        stringBuffer.append(":");
        if (this.b() != null) {
            stringBuffer.append(this.b());
        }
        stringBuffer.append(":");
        if (this.b() != null) {
            stringBuffer.append(this.c());
        }
        return stringBuffer.toString();
    }

    public static String a(String[] stringArray, String string, String string2) {
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("mailto:");
        if (!ed.b(string)) {
            ar.a(stringBuffer, "subject=" + ar.a(string));
        }
        if (!ed.b(string2)) {
            ar.a(stringBuffer, "body=" + ar.a(string2));
        }
        return stringBuffer.toString();
    }

    public static String b(String string, String string2) {
        StringBuffer stringBuffer = new StringBuffer();
        if (!ed.b(string)) {
            stringBuffer.append(string);
        }
        if (!ed.b(string2)) {
            if (stringBuffer.length() > 0) {
                stringBuffer.append(", ");
            }
            stringBuffer.append(string2);
        }
        return stringBuffer.toString();
    }

    public static String b(String string) {
        if (!ed.b(string)) {
            StringBuffer stringBuffer = new StringBuffer(string.length());
            for (int i = 0; i < string.length(); ++i) {
                char c = string.charAt(i);
                if (!Character.isDigit(c) && c != '+') continue;
                stringBuffer.append(c);
            }
            return stringBuffer.toString();
        }
        return "";
    }

    private static String j(String string) {
        if (string == null) {
            return "";
        }
        return string;
    }

    public final int x() {
        if (this.d == null) {
            return ps.a().b(this.b);
        }
        return this.d.a();
    }

    public final int w() {
        if (this.d != null) {
            return this.d.b();
        }
        return ps.a().a(this.b);
    }

    public final String S() {
        if (!ed.b(this.b())) {
            return this.b();
        }
        return this.J();
    }

    public final String M() {
        String string = this.A();
        String string2 = this.N();
        if (ar.i(string) && !ed.b(string2)) {
            return ar.h(string2);
        }
        return ar.h(string);
    }

    /*
     * Enabled aggressive block sorting
     */
    public final String v() {
        String string = !this.a.h(2) ? "" : this.a.g(2);
        if (ed.b(string)) {
            if (this.t()) {
                return this.S();
            }
            string = this.b();
            String string2 = this.c();
            if (!lh.r() ? string.equals("") : !string2.equals("")) {
                return string2;
            }
        }
        return string;
    }

    public final void a(short s) {
        if (this.k == null) {
            this.k = new Hashtable();
        }
        this.k.put(new Short(s), "");
    }

    public final boolean b(short s) {
        return this.k != null && this.k.containsKey(new Short(s));
    }

    public final boolean T() {
        return this.d != null;
    }

    public final boolean o() {
        return this.a.d(1) == 0;
    }

    public final boolean p() {
        return this.a.d(1) == 6;
    }

    public final boolean n() {
        return this.a.d(1) == 1;
    }

    public final boolean q() {
        return this.a.d(1) == 3;
    }

    public final boolean s() {
        return this.a.d(1) == 5;
    }

    public final boolean r() {
        return this.a.d(1) == 2;
    }

    private static boolean c(lk lk2) {
        return lk2.h(123) && lk2.b(123);
    }

    public final boolean X() {
        return this.a.h(126) && this.a.b(126);
    }

    public final boolean j() {
        lk lk2;
        return this.a.h(118) && (lk2 = this.a.f(118)).h(1) && lk2.d(1) > 0;
    }

    public final int k() {
        lk lk2;
        if (this.a.h(118) && (lk2 = this.a.f(118)).h(4)) {
            return lk2.d(4);
        }
        return 0;
    }

    public static lk b(lk lk2, int n) {
        if (lk2 != null && lk2.h(n)) {
            return lk2.f(n);
        }
        return null;
    }

    public static int b(lk lk2, int n, int n2) {
        try {
            if (lk2 != null && lk2.h(n)) {
                return lk2.d(n);
            }
            return n2;
        }
        catch (ClassCastException | IllegalArgumentException runtimeException) {
            return n2;
        }
    }

    public static long d(lk lk2, int n) {
        try {
            if (lk2 != null && lk2.h(n)) {
                return lk2.e(n);
            }
        }
        catch (IllegalArgumentException illegalArgumentException) {
            return 0L;
        }
        catch (ClassCastException classCastException) {}
        return 0L;
    }

    /*
     * Loose catch block
     */
    public static long e(lk lk2, int n) {
        try {
            if (lk2 != null && lk2.h(n)) {
                return lk2.e(n);
            }
        }
        catch (ClassCastException classCastException) {}
        return -1;
        catch (IllegalArgumentException illegalArgumentException) {
            return -1;
        }
    }

    public static String a(lk lk2, int n) {
        try {
            if (lk2 != null && lk2.h(n)) {
                return lk2.g(n);
            }
        }
        catch (ClassCastException classCastException) {}
        return "";
    }

    public static void a(DataInput dataInput, int n) {
        if (n >= 0) {
            if (n > 0) {
                byte[] byArray = new byte[Math.min(2048, n)];
                while (n > 0) {
                    int n2 = Math.min(n, byArray.length);
                    n -= n2;
                    dataInput.readFully(byArray, 0, n2);
                }
            }
            return;
        }
        throw new IllegalArgumentException();
    }

    /*
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    public static byte[] a(InputStream inputStream) {
        byte[] byArray;
        ByteArrayOutputStream byteArrayOutputStream;
        block5: {
            try {
                byteArrayOutputStream = new ByteArrayOutputStream(32);
            }
            catch (Throwable throwable) {
                ar.b(inputStream);
                throw throwable;
            }
            try {
                int n;
                byArray = new byte[512];
                while ((n = inputStream.read(byArray)) != -1) {
                    ((OutputStream)byteArrayOutputStream).write(byArray, 0, n);
                }
                break block5;
            }
            catch (Throwable throwable) {}
            ar.a(byteArrayOutputStream);
            throw throwable;
        }
        ar.a(byteArrayOutputStream);
        byArray = byteArrayOutputStream.toByteArray();
        ar.b(inputStream);
        return byArray;
    }

    public static lk a(cp cp2, DataInput dataInput) {
        lk lk2 = new lk(cp2);
        int n = dataInput.readInt();
        InputStream inputStream = new ks((InputStream)((Object)dataInput), Math.abs(n));
        if (n < 0) {
            inputStream = new of(inputStream);
        }
        lk2.a(inputStream);
        if (inputStream.read() != -1) {
            throw new IOException();
        }
        return lk2;
    }

    /*
     * Exception decompiling
     */
    public final void a(dm var1_1) {
        /*
         * 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: Extractable last case doesn't follow previous, and can't clone.
         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.op3rewriters.SwitchReplacer.examineSwitchContiguity(SwitchReplacer.java:611)
         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.op3rewriters.SwitchReplacer.replaceRawSwitches(SwitchReplacer.java:94)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:517)
         *     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");
    }

    /*
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    private ar(lk lk2) {
        dm dm2;
        this.a = lk2;
        lk lk3 = lk2.f(3);
        if (lk3 == null) {
            dm2 = null;
        } else {
            try {
                switch (lk3.d(1)) {
                    case 3: {
                        dm2 = om.b(lk3.f(7));
                        break;
                    }
                    default: {
                        throw new IOException("Unsupported Geometry");
                    }
                    case 1: {
                        dm2 = gu.a(lk3.f(2));
                        break;
                    }
                    case 2: {
                        dm2 = cw.a(lk3.f(3));
                        break;
                    }
                    case 4: {
                        dm2 = gu.e(lk3.f(13));
                        break;
                    }
                    case 5: {
                        dm2 = gu.b(lk3.f(14));
                        break;
                    }
                }
            }
            catch (IOException iOException) {
                me.a("PROTO", iOException);
                dm2 = null;
            }
        }
        this.c = dm2;
        aq[] aqArray = this.C();
        for (int i = 0; i < aqArray.length; ++i) {
            if (aqArray[i].i != 0) {
                continue;
            }
            try {
                byte[] byArray = aqArray[i].c;
                if (byArray == null) break;
                this.d = lh.k().g().a(byArray, 0, byArray.length);
                break;
            }
            catch (RuntimeException runtimeException) {
                me.a("PROTO", runtimeException);
                break;
            }
        }
        if (!lk2.b(22)) {
            this.b = 0;
            return;
        }
        switch (lk2.d(1)) {
            case 0: {
                if (ar.c(lk2)) {
                    this.b = (byte)15;
                    return;
                }
                this.b = 1;
                return;
            }
            case 6: {
                this.b = (byte)14;
                return;
            }
            case 4: {
                this.b = (byte)2;
                return;
            }
            case 3: {
                this.b = (byte)12;
                return;
            }
            case 2: 
            case 5: {
                this.b = (byte)11;
                return;
            }
            case 1: {
                this.b = (byte)10;
                return;
            }
        }
        this.b = 1;
    }

    public ar(dm dm2, String string, String string2, String string3, String string4, byte by2, String string5, String string6, String string7, gu[] guArray) {
        int n;
        lk lk2;
        this.a = new lk(la.n);
        this.a.b(2, ar.j(string));
        this.a(dm2);
        this.a.a(4, ar.j(string2));
        this.a.a(4, ar.j(string3));
        this.a.b(11, ar.j(string4));
        if (!ed.b(string5)) {
            lk lk3 = new lk(null);
            lk3.b(19, string5);
            lk2 = lk3;
            this.a.a(18, lk2);
        }
        if (!ed.b(string6)) {
            this.a.b(23, string6);
        }
        if (!ed.b(string7)) {
            this.a.b(24, string7);
        }
        switch (by2) {
            case 1: {
                n = 0;
                break;
            }
            case 15: {
                n = 0;
                this.a.a(123, true);
                break;
            }
            case 14: {
                n = 6;
                break;
            }
            case 12: {
                n = 3;
                break;
            }
            case 11: {
                n = 2;
                break;
            }
            case 10: {
                n = 1;
                break;
            }
            case 2: {
                n = 4;
                break;
            }
            default: {
                n = 0;
            }
        }
        this.a.h(1, n);
        lk2 = this.a;
        n = by2 == 0 ? 0 : 1;
        lk2.a(22, n != 0);
        for (n = 0; n < guArray.length; ++n) {
            lk2 = guArray[n].a();
            this.a.a(12, lk2);
        }
        this.b = by2;
    }

    private lk ae() {
        lk lk2;
        if (!this.a.h(90)) {
            lk2 = new lk(null);
            this.a.b(90, lk2);
        }
        if (!(lk2 = this.a.f(90)).h(94)) {
            lk2.b(94, new lk(null));
        }
        return lk2.f(94);
    }

    private lk ac() {
        lk lk2 = this.a != null && this.a.h(90) ? this.a.f(90) : null;
        if (lk2 != null && lk2.h(94)) {
            return lk2.f(94);
        }
        return null;
    }

    public final String I() {
        if (this.a.h(90)) {
            lk lk2 = this.a.f(90);
            StringBuffer stringBuffer = new StringBuffer();
            int n = lk2.i(91);
            if (n > 0) {
                for (int i = 0; i < n; ++i) {
                    stringBuffer.append(lk2.f(91, i));
                    if (i == n - 1) continue;
                    stringBuffer.append(" > ");
                }
            }
            return stringBuffer.toString();
        }
        return null;
    }

    public final String R() {
        int n;
        int n2;
        lk lk2 = this.a.f(118);
        StringBuffer stringBuffer = new StringBuffer();
        if (lk2.h(1)) {
            n2 = lk2.d(1);
            for (n = 0; n < 5; ++n) {
                stringBuffer.append('\u0001');
                if (n2 < 750) {
                    if (n2 >= 250) {
                        stringBuffer.append('\ued20');
                    } else {
                        stringBuffer.append('\ued21');
                    }
                } else {
                    stringBuffer.append('\ued1f');
                }
                n2 -= 1000;
            }
        }
        n2 = 0;
        if (lk2.h(5)) {
            for (n = 0; n < 5; ++n) {
                n2 += lk2.c(5, n);
            }
        }
        if (n2 > 0) {
            if (stringBuffer.length() > 0) {
                stringBuffer.append(" - ");
            }
            if (n2 != 1) {
                stringBuffer.append(ed.a(lh.d(381), new String[]{Integer.toString(n2)}));
            } else {
                stringBuffer.append(lh.d(382));
            }
        }
        return stringBuffer.toString();
    }

    public static String a(byte[] byArray, int n, int n2, boolean bl2) {
        block13: {
            block14: {
                block11: {
                    block12: {
                        StringBuffer stringBuffer = new StringBuffer(n2 - n);
                        while (n < n2) {
                            int n3 = byArray[n] & 0xFF;
                            ++n;
                            if (n3 > 127) {
                                if (n3 < 245) {
                                    int n4;
                                    int n5 = 224;
                                    int n6 = 1;
                                    int n7 = 31;
                                    int n8 = 128;
                                    while (n3 >= n5) {
                                        n5 = n5 >> 1 | 0x80;
                                        n4 = n6 != 1 ? 5 : 4;
                                        n8 <<= n4;
                                        ++n6;
                                        n7 >>= 1;
                                    }
                                    n5 = n3 & n7;
                                    for (n4 = 0; n4 < n6; ++n4) {
                                        n5 <<= 6;
                                        if (n < n2) {
                                            if (bl2 || (byArray[n] & 0xC0) == 128) {
                                                n5 |= byArray[n] & 0x3F;
                                                ++n;
                                                continue;
                                            }
                                            break block11;
                                        }
                                        if (bl2) {
                                            continue;
                                        }
                                        break block12;
                                    }
                                    if (!(!bl2 && n5 < n8 || n5 >= 55296 && n5 <= 57343)) {
                                        if (n5 > 65535) {
                                            int n9 = n5 - 65536;
                                            stringBuffer.append((char)(n9 >> 10 | 0xD800));
                                            stringBuffer.append((char)(0xDC00 | n9 & 0x3FF));
                                            continue;
                                        }
                                        stringBuffer.append((char)n5);
                                        continue;
                                    }
                                    break block13;
                                }
                                if (bl2) {
                                    stringBuffer.append((char)n3);
                                    continue;
                                }
                                break block14;
                            }
                            stringBuffer.append((char)n3);
                        }
                        return stringBuffer.toString();
                    }
                    throw new IllegalArgumentException("Invalid UTF8");
                }
                throw new IllegalArgumentException("Invalid UTF8");
            }
            throw new IllegalArgumentException("Invalid UTF8");
        }
        throw new IllegalArgumentException("Invalid UTF8");
    }

    public static int a(String string, byte[] byArray, int n) {
        int n2 = string.length();
        for (int i = 0; i < n2; ++i) {
            int n3;
            int n4 = string.charAt(i);
            if (n4 >= 55296 && n4 <= 57343 && i + 1 < n2 && ((n3 = string.charAt(i + 1)) & 0xFC00 ^ n4 & 0xFC00) == 1024) {
                int n5;
                ++i;
                if ((n3 & 0xFC00) != 55296) {
                    n5 = n3;
                } else {
                    n5 = n4;
                    n4 = n3;
                }
                n4 = ((n4 & 0x3FF) << 10 | n5 & 0x3FF) + 65536;
            }
            if (n4 > 127) {
                if (n4 > 2047) {
                    if (n4 > 65535) {
                        if (byArray != null) {
                            byArray[n] = (byte)(0xF0 | n4 >> 18);
                            byArray[n + 1] = (byte)(0x80 | n4 >> 12 & 0x3F);
                            byArray[n + 2] = (byte)(0x80 | n4 >> 6 & 0x3F);
                            byArray[n + 3] = (byte)(0x80 | n4 & 0x3F);
                        }
                        n += 4;
                        continue;
                    }
                    if (byArray != null) {
                        byArray[n] = (byte)(0xE0 | n4 >> 12);
                        byArray[n + 1] = (byte)(0x80 | n4 >> 6 & 0x3F);
                        byArray[n + 2] = (byte)(0x80 | n4 & 0x3F);
                    }
                    n += 3;
                    continue;
                }
                if (byArray != null) {
                    byArray[n] = (byte)(0xC0 | n4 >> 6);
                    byArray[n + 1] = (byte)(0x80 | n4 & 0x3F);
                }
                n += 2;
                continue;
            }
            if (byArray != null) {
                byArray[n] = (byte)n4;
            }
            ++n;
        }
        return n;
    }

    public static String c(String string) {
        int n = string.length();
        byte[] byArray = new byte[n];
        int n2 = 0;
        try {
            block6: for (int i = 0; i < n; ++i) {
                block8: {
                    char c = string.charAt(i);
                    switch (c) {
                        case '%': {
                            if (string.length() >= i + 3) {
                                byArray[n2] = (byte)Integer.parseInt(string.substring(i + 1, i + 3), 16);
                                i += 2;
                                ++n2;
                                continue block6;
                            }
                            break block8;
                        }
                        case '+': {
                            byArray[n2] = 32;
                            ++n2;
                            continue block6;
                        }
                        default: {
                            byArray[n2] = (byte)c;
                            ++n2;
                        }
                    }
                    continue;
                }
                throw new IOException("bad URL: " + string);
            }
        }
        catch (NumberFormatException numberFormatException) {
            throw new IOException(numberFormatException.getMessage());
        }
        return ar.a(byArray, 0, n2, true);
    }

    public static String a(String string) {
        byte[] byArray = ar.a(string);
        int n = byArray.length;
        StringBuffer stringBuffer = new StringBuffer(n);
        for (int i = 0; i < n; ++i) {
            byte by2 = byArray[i];
            if (!(65 <= by2 && by2 <= 90 || 97 <= by2 && by2 <= 122 || 48 <= by2 && by2 <= 57 || by2 == 45 || by2 == 95 || by2 == 46 || by2 == 33 || by2 == 126 || by2 == 42 || by2 == 39 || by2 == 40 || by2 == 41)) {
                if (by2 != 32) {
                    stringBuffer.append('%');
                    stringBuffer.append(a[by2 >> 4 & 0xF]);
                    stringBuffer.append(a[by2 & 0xF]);
                    continue;
                }
                stringBuffer.append('+');
                continue;
            }
            stringBuffer.append((char)by2);
        }
        return stringBuffer.toString();
    }

    public static String h(String string) {
        if (!ed.b(string)) {
            if (string.toLowerCase().startsWith("http://")) {
                string = string.substring("http://".length());
            }
            char[] cArray = new char[]{'/', '#', '?'};
            for (int i = 0; i < cArray.length; ++i) {
                int n = string.indexOf(cArray[i]);
                if (n == -1) continue;
                string = string.substring(0, n);
            }
            return string;
        }
        return "";
    }

    public static String a(String string, String string2) {
        int n;
        if (!(ed.b(string) || (n = string2.indexOf(58)) > 1 && n < 7)) {
            if (!string2.startsWith("//")) {
                n = string.indexOf(35);
                int n2 = string.indexOf(63);
                if (n != -1 || n2 != -1) {
                    if (n != -1 && n2 != -1) {
                        n = Math.min(n, n2);
                    } else if (n == -1) {
                        n = n2;
                    }
                    string = string.substring(0, n);
                }
                n = string.indexOf(58);
                if (string2.startsWith("/")) {
                    n = string.indexOf(47, n + 3);
                    StringBuffer stringBuffer = new StringBuffer();
                    if (n != -1) {
                        string = string.substring(0, n);
                    }
                    return stringBuffer.append(string).append(string2).toString();
                }
                n2 = string.lastIndexOf(47);
                if (n2 <= n + 2) {
                    return string + '/' + string2;
                }
                return string.substring(0, n2 + 1) + string2;
            }
            n = string.indexOf("//");
            StringBuffer stringBuffer = new StringBuffer();
            if (n != -1) {
                string = string.substring(0, n);
            }
            return stringBuffer.append(string).append(string2).toString();
        }
        return string2;
    }

    public static ar a(DataInput dataInput, short s) {
        if (s != 1025) {
            if (s == 1026) {
                dm dm2;
                String string = dataInput.readUTF();
                switch (dataInput.readByte()) {
                    case 4: {
                        dm2 = gu.a(dataInput);
                        break;
                    }
                    default: {
                        throw new IOException("Unsupported Geometry");
                    }
                    case 3: {
                        dm2 = om.c(dataInput);
                        break;
                    }
                    case 2: {
                        dm2 = cw.a(dataInput);
                        break;
                    }
                    case 1: {
                        dm2 = iv.a(dataInput);
                    }
                }
                String string2 = dataInput.readUTF();
                String string3 = dataInput.readUTF();
                dataInput.readUTF();
                dataInput.readUTF();
                dataInput.readUTF();
                dataInput.readUTF();
                dataInput.readUTF();
                String string4 = dataInput.readUTF();
                byte by2 = dataInput.readByte();
                if (by2 == 8 || by2 == 9) {
                    by2 = 1;
                }
                String string5 = dataInput.readUTF();
                String string6 = dataInput.readUTF();
                String string7 = dataInput.readUTF();
                int n = dataInput.readUnsignedShort();
                gu[] guArray = new gu[n];
                for (s = 0; s < n; s = (short)(s + 1)) {
                    String string8 = dataInput.readUTF();
                    String string9 = dataInput.readUTF();
                    int n2 = dataInput.readUnsignedShort();
                    Hashtable<String, String> hashtable = new Hashtable<String, String>();
                    String[] stringArray = new String[n2];
                    for (int i = 0; i < n2; ++i) {
                        stringArray[i] = dataInput.readUTF();
                        hashtable.put(stringArray[i], dataInput.readUTF());
                    }
                    guArray[s] = new gu(string8, string9, hashtable, stringArray);
                }
                if (by2 == 12) {
                    dataInput.readUTF();
                    dataInput.readUTF();
                    dataInput.readUTF();
                    s = (short)dataInput.readInt();
                    if (s > 0) {
                        dataInput.readFully(new byte[s]);
                    }
                }
                return new ar(dm2, string, string2, string3, string4, by2, string5, string6, string7, guArray);
            }
            lk lk2 = new lk(la.n);
            lk2.a((InputStream)((Object)dataInput), dataInput.readInt());
            return ar.a(lk2);
        }
        iv iv2 = iv.a(dataInput);
        dataInput.readUTF();
        dataInput.readUTF();
        String string = dataInput.readUTF();
        s = dataInput.readByte();
        String string10 = ed.a(lh.d(22), "");
        int n = string.indexOf(string10);
        String string11 = n != -1 ? string.substring(n += string10.length(), string.indexOf(31, n) - 1) : "";
        n = string.indexOf("dirto:");
        string10 = n != -1 ? string.substring(n += "dirto:".length(), string.indexOf(31, n)) : "";
        string = null;
        n = string10.indexOf(", ");
        if (n != -1) {
            String string12 = string10.substring(0, n);
            string = string10.substring(n + 2);
            string10 = string12;
        }
        ar ar2 = new ar(iv2, "", string10, string, string11, (byte)s);
        if (ar2.b >= 8) {
            dataInput.readUTF();
            dataInput.readByte();
            dataInput.readByte();
            dataInput.readByte();
            dataInput.readByte();
        }
        return ar2;
    }

    public final gu[] B() {
        int n = this.a.i(12);
        gu[] guArray = new gu[n];
        for (int i = 0; i < n; ++i) {
            guArray[i] = gu.a(this.a.e(12, i));
        }
        return guArray;
    }

    public final aq[] C() {
        int n = this.a.i(100);
        aq[] aqArray = new aq[n];
        for (int i = 0; i < n; ++i) {
            aqArray[i] = aq.a(this.a.e(100, i));
        }
        return aqArray;
    }
}

