Fast Orange v3.5.3版本的 MD5 值为:33b91aba50c566533dfd683a85f79158

以下内容为反编译后的 ag2.java 源代码,内容仅作参考


package com.free.vpn.proxy.hotspot;

import android.os.Build;
import android.text.TextUtils;
import androidx.constraintlayout.core.motion.utils.TypedValues;
import androidx.core.app.NotificationCompat;
import androidx.core.os.EnvironmentCompat;
import androidx.core.util.Pair;
import com.free.vpn.proxy.hotspot.data.model.billing.xiguapay.XiguapayCreateRequest;
import com.free.vpn.proxy.hotspot.ui.billing.subscription.base.BaseSubscriptionFragment;
import com.github.shadowsocks.fmt.v2ray.StandardV2RayBean;
import com.github.shadowsocks.plugin.PluginContract;
import com.google.android.gms.common.internal.ImagesContract;
import de.blinkt.openvpn.core.ConfigParser$ConfigParseError;
import java.io.BufferedReader;
import java.io.Reader;
import java.io.StringReader;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.Vector;

public final class ag2 {
    public Object a;
    public Object b;
    public Object c;
    public Object d;
    public Object e;
    public Object f;
    public Object g;
    public Object h;

    public ag2(int i) {
        if (i != 3) {
            return;
        }
        this.b = new String[]{"config", "tls-server"};
        this.c = new String[]{"tls-client", "allow-recursive-routing", "askpass", "auth-nocache", "up", "down", "route-up", "ipchange", "route-pre-down", "auth-user-pass-verify", "block-outside-dns", "client-cert-not-required", "dhcp-release", "dhcp-renew", "dh", "group", "ip-win32", "ifconfig-nowarn", "management-hold", "management", "management-client", "management-query-remote", "management-query-passwords", "management-query-proxy", "management-external-key", "management-forget-disconnect", "management-signal", "management-log-cache", "management-up-down", "management-client-user", "management-client-group", "pause-exit", "preresolve", PluginContract.SCHEME, "machine-readable-output", "persist-key", BaseSubscriptionFragment.KEY_PUSH, "register-dns", "route-delay", "route-gateway", "route-metric", "route-method", NotificationCompat.CATEGORY_STATUS, "script-security", "show-net-up", "suppress-timestamps", "tap-sleep", "tmp-dir", "tun-ipv6", "topology", "user", "win-sys"};
        this.d = new String[][]{new String[]{"setenv", "IV_GUI_VER"}, new String[]{"setenv", "IV_PLAT_VER"}, new String[]{"setenv", "IV_OPENVPN_GUI_VERSION"}, new String[]{"engine", "dynamic"}, new String[]{"setenv", "CLIENT_CERT"}, new String[]{"resolv-retry", "60"}};
        this.e = new String[]{ImagesContract.LOCAL, "remote", TypedValues.Custom.S_FLOAT, "port", "connect-retry", "connect-timeout", "connect-retry-max", "link-mtu", "tun-mtu", "tun-mtu-extra", "fragment", "mtu-disc", "local-port", "remote-port", "bind", "nobind", "proto", "http-proxy", "http-proxy-retry", "http-proxy-timeout", "http-proxy-option", "socks-proxy", "socks-proxy-retry", "http-proxy-user-pass", "explicit-exit-notify"};
        this.f = new HashSet(Arrays.asList((String[]) this.e));
        this.g = new HashMap();
        this.h = new HashMap();
    }

    public static void a(xx4 xx4Var, Vector vector, boolean z) {
        boolean z2 = false;
        if (z) {
            Iterator it = vector.iterator();
            boolean z3 = false;
            while (it.hasNext()) {
                Vector vector2 = (Vector) it.next();
                for (int i = 1; i < vector2.size(); i++) {
                    if (((String) vector2.get(i)).equals("block-local")) {
                        xx4Var.a0 = false;
                    } else if (((String) vector2.get(i)).equals("unblock-local")) {
                        xx4Var.a0 = true;
                    } else if (((String) vector2.get(i)).equals("!ipv4")) {
                        z3 = true;
                    } else if (((String) vector2.get(i)).equals("ipv6")) {
                        xx4Var.Q = true;
                    }
                }
            }
            z2 = z3;
        }
        if (!z || z2) {
            return;
        }
        xx4Var.B = true;
    }

    public static void b(Vector vector, BufferedReader bufferedReader) {
        String trim = ((String) vector.get(0)).trim();
        if (trim.startsWith("<") && trim.endsWith(">")) {
            String substring = trim.substring(1, trim.length() - 1);
            String format = String.format("</%s>", substring);
            String str = "[[INLINE]]";
            while (true) {
                String readLine = bufferedReader.readLine();
                if (readLine != null) {
                    if (readLine.trim().equals(format)) {
                        if (str.endsWith("\n")) {
                            str = str.substring(0, str.length() - 1);
                        }
                        vector.clear();
                        vector.add(substring);
                        vector.add(str);
                        return;
                    }
                    str = jf2.C(jf2.C(str, readLine), "\n");
                } else {
                    throw new ConfigParser$ConfigParseError(String.format("No endtag </%s> for starttag <%s> found", substring, substring));
                }
            }
        }
    }

    public static boolean h(String str) {
        if (str.equals("udp") || str.equals("udp4") || str.equals("udp6")) {
            return true;
        }
        if (str.equals("tcp-client") || str.equals(StandardV2RayBean.TYPE_TCP) || str.equals("tcp4") || str.endsWith("tcp4-client") || str.equals("tcp6") || str.endsWith("tcp6-client")) {
            return false;
        }
        throw new ConfigParser$ConfigParseError("Unsupported option to --proto ".concat(str));
    }

    public static Vector l(String str) {
        char c;
        boolean z;
        boolean z2;
        boolean z3;
        Vector vector = new Vector();
        if (str.length() == 0) {
            return vector;
        }
        char c2 = 1;
        String str2 = "";
        int i = 0;
        boolean z4 = false;
        char c3 = 0;
        while (true) {
            if (i < str.length()) {
                c = str.charAt(i);
            } else {
                c = 0;
            }
            if (!z4 && c == '\\' && c2 != 2) {
                z4 = true;
            } else if (c2 == 1) {
                if (!Character.isWhitespace(c) && c != 0) {
                    z3 = false;
                } else {
                    z3 = true;
                }
                if (!z3) {
                    if (c == ';' || c == '#') {
                        break;
                    }
                    if (!z4 && c == '\"') {
                        c2 = 3;
                    } else if (!z4 && c == '\'') {
                        c2 = 2;
                    } else {
                        c2 = 4;
                        c3 = c;
                    }
                }
                if (c2 == 5) {
                    vector.add(str2);
                    c2 = 1;
                    str2 = "";
                    c3 = 0;
                }
                if (z4 && c3 != 0 && c3 != '\\' && c3 != '\"') {
                    if (Character.isWhitespace(c3) && c3 != 0) {
                        z2 = false;
                    } else {
                        z2 = true;
                    }
                    if (!z2) {
                        throw new ConfigParser$ConfigParseError("Options warning: Bad backslash ('\\') usage");
                    }
                }
                z4 = false;
            } else {
                if (c2 == 4) {
                    if (!z4) {
                        if (!Character.isWhitespace(c) && c != 0) {
                            z = false;
                        } else {
                            z = true;
                        }
                    }
                    c3 = c;
                } else if (c2 == 3) {
                    if (!z4) {
                    }
                    c3 = c;
                } else if (c2 == 2) {
                }
                if (c2 == 5) {
                }
                if (z4) {
                    if (Character.isWhitespace(c3)) {
                    }
                    z2 = true;
                    if (!z2) {
                    }
                }
                z4 = false;
            }
            if (c3 != 0) {
                str2 = str2 + c3;
            }
            int i2 = i + 1;
            if (i >= str.length()) {
                break;
            }
            i = i2;
        }
        return vector;
    }

    public final xx4 c() {
        boolean z;
        boolean z2;
        int i;
        int i2;
        int i3;
        Vector e;
        Vector d;
        Vector e2;
        Vector vector;
        Vector vector2;
        Iterator it;
        boolean z3;
        String join;
        xx4 xx4Var = new xx4();
        xx4Var.o0 = EnvironmentCompat.MEDIA_UNKNOWN;
        boolean z4 = false;
        xx4Var.C = false;
        xx4Var.t = false;
        xx4Var.B = false;
        xx4Var.Q = false;
        xx4Var.F = false;
        xx4Var.E = false;
        xx4Var.S = false;
        xx4Var.a0 = true;
        xx4Var.l0 = false;
        xx4Var.c0 = 0;
        xx4Var.P = false;
        if (((HashMap) this.g).containsKey("client") || ((HashMap) this.g).containsKey("pull")) {
            xx4Var.C = true;
            ((HashMap) this.g).remove("pull");
            ((HashMap) this.g).remove("client");
        }
        int i4 = 2;
        Vector e3 = e(1, 2, "secret");
        int i5 = 3;
        if (e3 != null) {
            xx4Var.a = 4;
            xx4Var.v = true;
            xx4Var.q = (String) e3.get(1);
            if (e3.size() == 3) {
                xx4Var.e = (String) e3.get(2);
            }
            z = false;
        } else {
            z = true;
        }
        Vector d2 = d(1, 4, "route");
        if (d2 != null) {
            Iterator it2 = d2.iterator();
            String str = "";
            String str2 = str;
            while (it2.hasNext()) {
                Vector vector3 = (Vector) it2.next();
                String str3 = vector3.size() >= i5 ? (String) vector3.get(i4) : "255.255.255.255";
                String str4 = vector3.size() >= 4 ? (String) vector3.get(i5) : "vpn_gateway";
                try {
                    wl wlVar = new wl((String) vector3.get(1), str3);
                    if (str4.equals("net_gateway")) {
                        str2 = str2 + wlVar.toString() + " ";
                    } else {
                        str = str + wlVar.toString() + " ";
                    }
                    i4 = 2;
                    i5 = 3;
                } catch (ArrayIndexOutOfBoundsException unused) {
                    throw new ConfigParser$ConfigParseError(jf2.o("Could not parse netmask of route ", str3));
                } catch (NumberFormatException unused2) {
                    throw new ConfigParser$ConfigParseError(jf2.o("Could not parse netmask of route ", str3));
                }
            }
            xx4Var.D = str;
            xx4Var.b0 = str2;
        }
        Vector d3 = d(1, 4, "route-ipv6");
        if (d3 != null) {
            Iterator it3 = d3.iterator();
            String str5 = "";
            while (it3.hasNext()) {
                str5 = jf2.r(jf2.s(str5), (String) ((Vector) it3.next()).get(1), " ");
            }
            xx4Var.R = str5;
        }
        if (e(0, 0, "route-nopull") != null) {
            xx4Var.J = true;
        }
        Vector d4 = d(1, 2, "tls-auth");
        if (d4 != null) {
            Iterator it4 = d4.iterator();
            while (it4.hasNext()) {
                Vector vector4 = (Vector) it4.next();
                if (vector4 != null) {
                    if (!((String) vector4.get(1)).equals("[inline]")) {
                        xx4Var.q = (String) vector4.get(1);
                        xx4Var.v = true;
                    }
                    if (vector4.size() == 3) {
                        xx4Var.e = (String) vector4.get(2);
                    }
                }
            }
        }
        Vector e4 = e(1, 1, "key-direction");
        if (e4 != null) {
            xx4Var.e = (String) e4.get(1);
        }
        String[] strArr = {"tls-crypt", "tls-crypt-v2"};
        for (int i6 = 0; i6 < 2; i6++) {
            String str6 = strArr[i6];
            Vector e5 = e(1, 1, str6);
            if (e5 != null) {
                xx4Var.v = true;
                xx4Var.q = (String) e5.get(1);
                xx4Var.e = str6;
            }
        }
        int i7 = 7;
        Vector d5 = d(0, 7, "redirect-gateway");
        if (d5 != null) {
            a(xx4Var, d5, true);
        }
        Vector d6 = d(0, 5, "redirect-private");
        if (d6 != null) {
            a(xx4Var, d6, false);
        }
        Vector e6 = e(1, 1, "dev");
        Vector e7 = e(1, 1, "dev-type");
        if ((e7 == null || !((String) e7.get(1)).equals("tun")) && ((e6 == null || !((String) e6.get(1)).startsWith("tun")) && !(e7 == null && e6 == null))) {
            throw new ConfigParser$ConfigParseError("Sorry. Only tun mode is supported. See the FAQ for more detail");
        }
        Vector e8 = e(0, 1, "mssfix");
        if (e8 != null) {
            if (e8.size() >= 2) {
                try {
                    xx4Var.c0 = Integer.parseInt((String) e8.get(1));
                } catch (NumberFormatException unused3) {
                    throw new ConfigParser$ConfigParseError("Argument to --mssfix has to be an integer");
                }
            } else {
                xx4Var.c0 = 1450;
            }
        }
        Vector e9 = e(1, 1, "tun-mtu");
        if (e9 != null) {
            try {
                xx4Var.k0 = Integer.parseInt((String) e9.get(1));
            } catch (NumberFormatException unused4) {
                throw new ConfigParser$ConfigParseError("Argument to --tun-mtu has to be an integer");
            }
        }
        Vector e10 = e(1, 1, PluginContract.COLUMN_MODE);
        if (e10 != null && !((String) e10.get(1)).equals("p2p")) {
            throw new ConfigParser$ConfigParseError("Invalid mode for --mode specified, need p2p");
        }
        int i8 = 2;
        Vector d7 = d(2, 2, "dhcp-option");
        if (d7 != null) {
            Iterator it5 = d7.iterator();
            while (it5.hasNext()) {
                Vector vector5 = (Vector) it5.next();
                String str7 = (String) vector5.get(1);
                String str8 = (String) vector5.get(i8);
                if (str7.equals("DOMAIN")) {
                    xx4Var.A = (String) vector5.get(i8);
                } else if (str7.equals("DNS")) {
                    xx4Var.z = true;
                    if (xx4Var.w.equals("8.8.8.8")) {
                        xx4Var.w = str8;
                    } else {
                        xx4Var.x = str8;
                    }
                }
                i8 = 2;
            }
        }
        Vector e11 = e(2, 2, "ifconfig");
        if (e11 != null) {
            try {
                xx4Var.y = new wl((String) e11.get(1), (String) e11.get(2)).toString();
            } catch (NumberFormatException e12) {
                throw new ConfigParser$ConfigParseError("Could not pase ifconfig IP address: " + e12.getLocalizedMessage());
            }
        }
        if (e(0, 0, "remote-random-hostname") != null) {
            xx4Var.K = true;
        }
        if (e(0, 0, TypedValues.Custom.S_FLOAT) != null) {
            xx4Var.L = true;
        }
        if (e(0, 1, "comp-lzo") != null) {
            xx4Var.t = true;
        }
        Vector e13 = e(1, 1, "cipher");
        if (e13 != null) {
            xx4Var.O = (String) e13.get(1);
        }
        Vector e14 = e(1, 1, "auth");
        if (e14 != null) {
            xx4Var.X = (String) e14.get(1);
        }
        Vector e15 = e(1, 1, "ca");
        if (e15 != null) {
            xx4Var.s = (String) e15.get(1);
        }
        Vector e16 = e(1, 1, "cert");
        if (e16 != null) {
            xx4Var.d = (String) e16.get(1);
            xx4Var.a = 0;
            z = false;
        }
        Vector e17 = e(1, 1, XiguapayCreateRequest.K_TOKEN);
        if (e17 != null) {
            xx4Var.r = (String) e17.get(1);
        }
        Vector e18 = e(1, 1, "pkcs12");
        if (e18 != null) {
            xx4Var.u = (String) e18.get(1);
            i = 2;
            xx4Var.a = 2;
            z2 = false;
        } else {
            z2 = z;
            i = 2;
        }
        if (e(1, 1, "cryptoapicert") != null) {
            xx4Var.a = i;
            z2 = false;
        }
        Vector e19 = e(1, i, "compat-names");
        Vector e20 = e(1, 1, "no-name-remapping");
        Vector e21 = e(1, 1, "tls-remote");
        if (e21 != null) {
            xx4Var.G = (String) e21.get(1);
            xx4Var.E = true;
            xx4Var.Y = 0;
            if (e19 != null) {
                i2 = 2;
            } else {
                i2 = 2;
            }
        } else {
            i2 = 2;
        }
        Vector e22 = e(1, i2, "verify-x509-name");
        if (e22 != null) {
            xx4Var.G = (String) e22.get(1);
            xx4Var.E = true;
            if (e22.size() > i2) {
                if (((String) e22.get(i2)).equals("name")) {
                    xx4Var.Y = 3;
                } else if (!((String) e22.get(i2)).equals("subject")) {
                    if (!((String) e22.get(i2)).equals("name-prefix")) {
                        throw new ConfigParser$ConfigParseError("Unknown parameter to verify-x509-name: " + ((String) e22.get(i2)));
                    }
                    xx4Var.Y = 4;
                }
            }
            xx4Var.Y = i2;
        }
        Vector e23 = e(1, 1, "x509-username-field");
        if (e23 != null) {
            xx4Var.Z = (String) e23.get(1);
        }
        Vector e24 = e(1, 1, "verb");
        if (e24 != null) {
        }
        if (e(0, 0, "nobind") != null) {
            xx4Var.P = true;
        }
        if (e(0, 0, "persist-tun") != null) {
            xx4Var.S = true;
        }
        if (e(0, 0, "push-peer-info") != null) {
            xx4Var.l0 = true;
        }
        Vector e25 = e(1, 2, "connect-retry");
        if (e25 != null) {
            xx4Var.U = (String) e25.get(1);
            if (e25.size() > 2) {
                xx4Var.V = (String) e25.get(2);
            }
        }
        Vector e26 = e(1, 1, "connect-retry-max");
        if (e26 != null) {
            xx4Var.T = (String) e26.get(1);
        }
        Vector d8 = d(1, 1, "remote-cert-tls");
        if (d8 != null) {
            if (((String) ((Vector) d8.get(0)).get(1)).equals("server")) {
                xx4Var.F = true;
            } else {
                ((HashMap) this.g).put("remotetls", d8);
            }
        }
        Vector e27 = e(0, 1, "auth-user-pass");
        if (e27 != null) {
            if (z2) {
                i7 = 3;
            } else {
                int i9 = xx4Var.a;
                if (i9 == 0) {
                    xx4Var.a = 5;
                }
                if (e27.size() > 1) {
                    if (!((String) e27.get(1)).startsWith("[[INLINE]]")) {
                        this.a = (String) e27.get(1);
                    }
                    xx4Var.I = null;
                    String[] split = xx4.g((String) e27.get(1)).split("\n");
                    if (split.length >= 2) {
                        xx4Var.I = split[0];
                        xx4Var.H = split[1];
                    }
                }
            }
            xx4Var.a = i7;
            if (e27.size() > 1) {
            }
        }
        Vector e28 = e(1, 1, "auth-retry");
        if (e28 != null) {
            if (!((String) e28.get(1)).equals("none")) {
                if (!((String) e28.get(1)).equals("nointeract") && !((String) e28.get(1)).equals("interact")) {
                    throw new ConfigParser$ConfigParseError("Unknown parameter to auth-retry: " + ((String) e28.get(2)));
                }
                i3 = 2;
                xx4Var.j0 = 2;
                e = e(1, i3, "crl-verify");
                if (e != null) {
                    if (e.size() == 3 && ((String) e.get(i3)).equals("dir")) {
                        StringBuilder sb = new StringBuilder();
                        sb.append(xx4Var.N);
                        if (Build.VERSION.SDK_INT > 26) {
                            StringBuilder sb2 = new StringBuilder();
                            Iterator it6 = e.iterator();
                            if (it6.hasNext()) {
                                while (true) {
                                    sb2.append((CharSequence) it6.next());
                                    if (!it6.hasNext()) {
                                        break;
                                    }
                                    sb2.append((CharSequence) " ");
                                }
                            }
                            join = sb2.toString();
                        } else {
                            join = TextUtils.join(" ", e);
                        }
                        xx4Var.N = jf2.r(sb, join, "\n");
                    } else {
                        xx4Var.h0 = (String) e.get(1);
                    }
                }
                Pair k = k(null);
                xx4Var.d0 = (x50[]) k.second;
                d = d(1, 1, "connection");
                if (xx4Var.d0.length <= 0 && d != null) {
                    throw new ConfigParser$ConfigParseError("Using a <connection> block and --remote is not allowed.");
                }
                if (d != null) {
                    xx4Var.d0 = new x50[d.size()];
                    Iterator it7 = d.iterator();
                    int i10 = 0;
                    while (it7.hasNext()) {
                        String str9 = (String) ((Vector) it7.next()).get(1);
                        x50 x50Var = (x50) k.first;
                        ag2 ag2Var = new ag2(3);
                        ag2Var.i(new StringReader(str9.substring(10)));
                        x50[] x50VarArr = (x50[]) ag2Var.k(x50Var).second;
                        if (x50VarArr.length != 1) {
                            throw new ConfigParser$ConfigParseError("A <connection> block must have exactly one remote");
                        }
                        xx4Var.d0[i10] = x50VarArr[0];
                        i10++;
                    }
                }
                if (e(0, 0, "remote-random") != null) {
                    xx4Var.e0 = true;
                }
                e2 = e(1, 1, "proto-force");
                if (e2 != null) {
                    String str10 = (String) e2.get(1);
                    if (str10.equals("udp")) {
                        z3 = true;
                    } else {
                        if (!str10.equals(StandardV2RayBean.TYPE_TCP)) {
                            throw new ConfigParser$ConfigParseError(String.format("Unknown protocol %s in proto-force", str10));
                        }
                        z3 = false;
                    }
                    for (x50 x50Var2 : xx4Var.d0) {
                        if (x50Var2.c == z3) {
                            x50Var2.q = false;
                        }
                    }
                }
                vector = (Vector) ((HashMap) this.h).get("FRIENDLY_NAME");
                if (vector != null && vector.size() > 1) {
                    xx4Var.b = (String) vector.get(1);
                }
                vector2 = (Vector) ((HashMap) this.h).get("USERNAME");
                if (vector2 != null && vector2.size() > 1) {
                    xx4Var.I = (String) vector2.get(1);
                }
                for (String str11 : (String[]) this.b) {
                    if (((HashMap) this.g).containsKey(str11)) {
                        throw new ConfigParser$ConfigParseError(String.format("Unsupported Option %s encountered in config file. Aborting", str11));
                    }
                }
                for (String str12 : (String[]) this.c) {
                    ((HashMap) this.g).remove(str12);
                }
                it = ((HashMap) this.g).values().iterator();
                while (it.hasNext()) {
                    Iterator it8 = ((Vector) it.next()).iterator();
                    while (it8.hasNext()) {
                        if (!g((Vector) it8.next())) {
                            z4 = true;
                        }
                    }
                }
                if (z4) {
                    xx4Var.N = "# These options found in the config file do not map to config settings:\n" + xx4Var.N;
                    Iterator it9 = ((HashMap) this.g).values().iterator();
                    while (it9.hasNext()) {
                        xx4Var.N += f((Vector) it9.next());
                    }
                    xx4Var.M = true;
                }
                if (xx4Var.G.equals(xx4Var.o0)) {
                    xx4Var.G = "";
                }
                return xx4Var;
            }
            xx4Var.j0 = 0;
        }
        i3 = 2;
        e = e(1, i3, "crl-verify");
        if (e != null) {
        }
        Pair k2 = k(null);
        xx4Var.d0 = (x50[]) k2.second;
        d = d(1, 1, "connection");
        if (xx4Var.d0.length <= 0) {
        }
        if (d != null) {
        }
        if (e(0, 0, "remote-random") != null) {
        }
        e2 = e(1, 1, "proto-force");
        if (e2 != null) {
        }
        vector = (Vector) ((HashMap) this.h).get("FRIENDLY_NAME");
        if (vector != null) {
            xx4Var.b = (String) vector.get(1);
        }
        vector2 = (Vector) ((HashMap) this.h).get("USERNAME");
        if (vector2 != null) {
            xx4Var.I = (String) vector2.get(1);
        }
        while (r6 < r5) {
        }
        while (r6 < r5) {
        }
        it = ((HashMap) this.g).values().iterator();
        while (it.hasNext()) {
        }
        if (z4) {
        }
        if (xx4Var.G.equals(xx4Var.o0)) {
        }
        return xx4Var;
    }

    public final Vector d(int i, int i2, String str) {
        Vector vector = (Vector) ((HashMap) this.g).get(str);
        if (vector == null) {
            return null;
        }
        Iterator it = vector.iterator();
        while (it.hasNext()) {
            Vector vector2 = (Vector) it.next();
            if (vector2.size() < i + 1 || vector2.size() > i2 + 1) {
                throw new ConfigParser$ConfigParseError(String.format(Locale.getDefault(), "Option %s has %d parameters, expected between %d and %d", str, Integer.valueOf(vector2.size() - 1), Integer.valueOf(i), Integer.valueOf(i2)));
            }
        }
        ((HashMap) this.g).remove(str);
        return vector;
    }

    public final Vector e(int i, int i2, String str) {
        Vector d = d(i, i2, str);
        if (d == null) {
            return null;
        }
        return (Vector) d.lastElement();
    }

    public final String f(Vector vector) {
        Iterator it = vector.iterator();
        String str = "";
        while (it.hasNext()) {
            Vector vector2 = (Vector) it.next();
            if (!g(vector2)) {
                if (vector2.size() == 2 && "extra-certs".equals(vector2.get(0))) {
                    StringBuilder s = jf2.s(str);
                    s.append(xx4.m((String) vector2.get(0), (String) vector2.get(1)));
                    str = s.toString();
                } else {
                    Iterator it2 = vector2.iterator();
                    while (it2.hasNext()) {
                        String str2 = (String) it2.next();
                        StringBuilder s2 = jf2.s(str);
                        s2.append(xx4.o(str2));
                        s2.append(" ");
                        str = s2.toString();
                    }
                    str = jf2.C(str, "\n");
                }
            }
        }
        return str;
    }

    public final boolean g(Vector vector) {
        for (String[] strArr : (String[][]) this.d) {
            if (vector.size() >= strArr.length) {
                boolean z = true;
                for (int i = 0; i < strArr.length; i++) {
                    if (!strArr[i].equals(vector.get(i))) {
                        z = false;
                    }
                }
                if (z) {
                    return true;
                }
            }
        }
        return false;
    }

    public final void i(Reader reader) {
        HashMap hashMap = new HashMap();
        hashMap.put("server-poll-timeout", "timeout-connect");
        BufferedReader bufferedReader = new BufferedReader(reader);
        int i = 0;
        while (true) {
            try {
                String readLine = bufferedReader.readLine();
                i++;
                if (readLine == null) {
                    return;
                }
                if (i == 1) {
                    if (readLine.startsWith("PK\u0003\u0004") || readLine.startsWith("PK\u0007\u00008")) {
                        break;
                    } else if (readLine.startsWith("\ufeff")) {
                        readLine = readLine.substring(1);
                    }
                }
                if (readLine.startsWith("# OVPN_ACCESS_SERVER_")) {
                    String[] split = readLine.split("#\\sOVPN_ACCESS_SERVER_", 2)[1].split("=", 2);
                    Vector vector = new Vector();
                    Collections.addAll(vector, split);
                    ((HashMap) this.h).put((String) vector.get(0), vector);
                } else {
                    Vector l = l(readLine);
                    if (l.size() != 0) {
                        if (((String) l.get(0)).startsWith("--")) {
                            l.set(0, ((String) l.get(0)).substring(2));
                        }
                        b(l, bufferedReader);
                        String str = (String) l.get(0);
                        if (hashMap.get(str) != null) {
                            str = (String) hashMap.get(str);
                        }
                        if (!((HashMap) this.g).containsKey(str)) {
                            ((HashMap) this.g).put(str, new Vector());
                        }
                        ((Vector) ((HashMap) this.g).get(str)).add(l);
                    }
                }
            } catch (OutOfMemoryError e) {
                throw new ConfigParser$ConfigParseError("File too large to parse: " + e.getLocalizedMessage());
            }
        }
        throw new ConfigParser$ConfigParseError("Input looks like a ZIP Archive. Import is only possible for OpenVPN config files (.ovpn/.conf)");
    }

    public final void j(String str) {
        HashMap hashMap = new HashMap();
        hashMap.put("server-poll-timeout", "timeout-connect");
        String[] split = str.split("\n");
        int i = 0;
        loop0: while (i < split.length) {
            try {
                String str2 = split[i];
                i++;
                if (str2 != null && !str2.isEmpty()) {
                    if (i == 1) {
                        if (!str2.startsWith("PK\u0003\u0004") && !str2.startsWith("PK\u0007\u00008")) {
                            if (str2.startsWith("\ufeff")) {
                                str2 = str2.substring(1);
                            }
                        } else {
                            throw new ConfigParser$ConfigParseError("Input looks like a ZIP Archive. Import is only possible for OpenVPN config files (.ovpn/.conf)");
                        }
                    }
                    if (str2.startsWith("# OVPN_ACCESS_SERVER_")) {
                        String[] split2 = str2.split("#\\sOVPN_ACCESS_SERVER_", 2)[1].split("=", 2);
                        Vector vector = new Vector();
                        Collections.addAll(vector, split2);
                        ((HashMap) this.h).put((String) vector.get(0), vector);
                    } else {
                        Vector l = l(str2);
                        if (l.size() != 0) {
                            if (((String) l.get(0)).startsWith("--")) {
                                l.set(0, ((String) l.get(0)).substring(2));
                            }
                            String trim = ((String) l.get(0)).trim();
                            if (trim.startsWith("<") && trim.endsWith(">")) {
                                String substring = trim.substring(1, trim.length() - 1);
                                String str3 = "[[INLINE]]";
                                String format = String.format("</%s>", substring);
                                while (true) {
                                    String str4 = split[i];
                                    i++;
                                    if (str4 == null || str4.isEmpty()) {
                                        break loop0;
                                    }
                                    if (str4.trim().equals(format)) {
                                        if (str3.endsWith("\n")) {
                                            str3 = str3.substring(0, str3.length() - 1);
                                        }
                                        l.clear();
                                        l.add(substring);
                                        l.add(str3);
                                    } else {
                                        str3 = (str3 + str4) + "\n";
                                    }
                                }
                                throw new ConfigParser$ConfigParseError(String.format("No endtag </%s> for starttag <%s> found", substring, substring));
                            }
                            String str5 = (String) l.get(0);
                            if (hashMap.get(str5) != null) {
                                str5 = (String) hashMap.get(str5);
                            }
                            if (!((HashMap) this.g).containsKey(str5)) {
                                ((HashMap) this.g).put(str5, new Vector());
                            }
                            ((Vector) ((HashMap) this.g).get(str5)).add(l);
                        }
                    }
                }
                return;
            } catch (OutOfMemoryError e) {
                throw new ConfigParser$ConfigParseError("File too large to parse: " + e.getLocalizedMessage());
            }
        }
    }

    public final Pair k(x50 x50Var) {
        x50 clone;
        if (x50Var != null) {
            try {
                clone = x50Var.clone();
            } catch (CloneNotSupportedException e) {
                e.printStackTrace();
                return null;
            }
        } else {
            clone = new x50();
        }
        Vector e2 = e(1, 1, "port");
        if (e2 != null) {
            clone.b = (String) e2.get(1);
        }
        Vector e3 = e(1, 1, "rport");
        if (e3 != null) {
            clone.b = (String) e3.get(1);
        }
        Vector e4 = e(1, 1, "proto");
        if (e4 != null) {
            clone.c = h((String) e4.get(1));
        }
        Vector e5 = e(1, 1, "connect-timeout");
        int i = 0;
        if (e5 != null) {
            try {
                clone.r = Integer.parseInt((String) e5.get(1));
            } catch (NumberFormatException e6) {
                throw new ConfigParser$ConfigParseError(String.format("Argument to connect-timeout (%s) must to be an integer: %s", e5.get(1), e6.getLocalizedMessage()));
            }
        }
        Vector e7 = e(1, 2, "socks-proxy");
        if (e7 == null) {
            e7 = e(2, 2, "http-proxy");
        }
        if (e7 != null) {
            if (((String) e7.get(0)).equals("socks-proxy")) {
                clone.s = 3;
                clone.u = "1080";
            } else {
                clone.s = 2;
            }
            clone.t = (String) e7.get(1);
            if (e7.size() >= 3) {
                clone.u = (String) e7.get(2);
            }
        }
        Vector e8 = e(1, 1, "http-proxy-user-pass");
        if (e8 != null) {
            String[] split = xx4.g((String) e8.get(1)).split("\n");
            if (split.length >= 2) {
                clone.w = split[0];
                clone.x = split[1];
                clone.v = true;
            }
        }
        Vector d = d(1, 3, "remote");
        Vector vector = new Vector();
        for (Map.Entry entry : ((HashMap) this.g).entrySet()) {
            if (x50Var != null || ((HashSet) this.f).contains(entry.getKey())) {
                clone.d += f((Vector) entry.getValue());
                vector.add((String) entry.getKey());
            }
        }
        Iterator it = vector.iterator();
        while (it.hasNext()) {
            ((HashMap) this.g).remove((String) it.next());
        }
        String str = clone.d;
        if (str != null && !"".equals(str.trim())) {
            clone.e = true;
        }
        if (d == null) {
            d = new Vector();
        }
        x50[] x50VarArr = new x50[d.size()];
        Iterator it2 = d.iterator();
        while (it2.hasNext()) {
            Vector vector2 = (Vector) it2.next();
            try {
                x50VarArr[i] = clone.clone();
            } catch (CloneNotSupportedException e9) {
                e9.printStackTrace();
            }
            int size = vector2.size();
            if (size != 2) {
                if (size != 3) {
                    if (size == 4) {
                        x50VarArr[i].c = h((String) vector2.get(3));
                    } else {
                        i++;
                    }
                }
                x50VarArr[i].b = (String) vector2.get(2);
            }
            x50VarArr[i].a = (String) vector2.get(1);
            i++;
        }
        return Pair.create(clone, x50VarArr);
    }

    public ag2(String str, Class cls, Class cls2, String str2, boolean z, boolean z2) {
        this.a = pb1.n(cls, jf2.o("get", str), new Class[0]);
        this.b = pb1.n(cls2, jf2.o("get", str), new Class[0]);
        this.c = pb1.n(cls2, jf2.o("set", str), new Class[]{((Method) this.a).getReturnType()});
        this.d = z2 ? pb1.n(cls, jf2.o("has", str), new Class[0]) : null;
        this.e = z2 ? pb1.n(cls2, jf2.o("has", str), new Class[0]) : null;
        this.f = pb1.n(cls2, jf2.o("clear", str), new Class[0]);
        this.g = z ? pb1.n(cls, jf2.D("get", str2, "Case"), new Class[0]) : null;
        this.h = z ? pb1.n(cls2, jf2.D("get", str2, "Case"), new Class[0]) : null;
    }

    public ag2(String str, String str2, ArrayList arrayList, String str3, String str4, String str5, String str6, io.sentry.o2 o2Var) {
        this.a = str;
        this.b = str2;
        this.c = arrayList;
        this.d = str3;
        this.e = str4;
        this.f = str5;
        this.g = str6;
        this.h = o2Var;
    }
}