导航菜单

页面标题

页面副标题

Chaupal v3.2 - h0.java 源代码

正在查看: Chaupal v3.2 应用的 h0.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package q5;

import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.database.Cursor;
import android.hardware.display.DisplayManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Parcel;
import android.os.StatFs;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.WindowManager;
import android.view.autofill.AutofillManager;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import com.connectsdk.service.airplay.PListParser;
import com.facebook.AccessToken;
import com.facebook.FacebookException;
import com.facebook.GraphRequest;
import com.facebook.HttpMethod;
import com.facebook.internal.FeatureManager;
import com.google.ads.interactivemedia.v3.impl.data.br;
import com.google.ads.interactivemedia.v3.internal.aen;
import java.io.BufferedInputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigInteger;
import java.net.HttpURLConnection;
import java.net.URLConnection;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import java.util.Set;
import java.util.TimeZone;
import java.util.regex.Pattern;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.m;
import kotlin.text.Regex;
import org.jetbrains.annotations.NotNull;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;

@Metadata
public final class h0 {

    private static int f18169b;

    private static Locale f18177j;

    @NotNull
    public static final h0 f18168a = new h0();

    private static long f18170c = -1;

    private static long f18171d = -1;

    private static long f18172e = -1;

    @NotNull
    private static String f18173f = "";

    @NotNull
    private static String f18174g = "";

    @NotNull
    private static String f18175h = "NoCarrier";

    private static String f18176i = "";

    @Metadata
    public interface a {
        void a(JSONObject jSONObject);

        void b(FacebookException facebookException);
    }

    private h0() {
    }

    @NotNull
    public static final Locale A() {
        Locale N = N();
        if (N != null) {
            return N;
        }
        Locale locale = Locale.getDefault();
        Intrinsics.checkNotNullExpressionValue(locale, "getDefault()");
        return locale;
    }

    private final void A0() {
        try {
            if (r()) {
                StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
                f18171d = statFs.getBlockCount() * statFs.getBlockSize();
            }
            f18171d = l(f18171d);
        } catch (Exception unused) {
        }
    }

    private final String B() {
        AccessToken e7 = AccessToken.f9149m.e();
        return (e7 == null || e7.k() == null) ? "facebook" : e7.k();
    }

    public static final void B0(Runnable runnable) {
        try {
            q4.t tVar = q4.t.f18071a;
            q4.t.u().execute(runnable);
        } catch (Exception unused) {
        }
    }

    public static final JSONObject C() {
        q4.t tVar = q4.t.f18071a;
        String string = q4.t.m().getSharedPreferences("com.facebook.sdk.DataProcessingOptions", 0).getString("data_processing_options", null);
        if (string != null) {
            try {
                return new JSONObject(string);
            } catch (JSONException unused) {
            }
        }
        return null;
    }

    public static final void C0(@NotNull JSONObject jSONObject, q5.a aVar, String str, boolean z6, @NotNull Context context) throws JSONException {
        Intrinsics.checkNotNullParameter(jSONObject, "params");
        Intrinsics.checkNotNullParameter(context, "context");
        FeatureManager featureManager = FeatureManager.f9386a;
        FeatureManager.Feature feature = FeatureManager.Feature.ServiceUpdateCompliance;
        if (!FeatureManager.g(feature)) {
            jSONObject.put("anon_id", str);
        }
        jSONObject.put("application_tracking_enabled", !z6);
        q4.t tVar = q4.t.f18071a;
        jSONObject.put("advertiser_id_collection_enabled", q4.t.l());
        if (aVar != null) {
            if (FeatureManager.g(feature)) {
                f18168a.c(jSONObject, aVar, str, context);
            }
            if (aVar.j() != null) {
                if (FeatureManager.g(feature)) {
                    f18168a.d(jSONObject, aVar, context);
                } else {
                    jSONObject.put("attribution", aVar.j());
                }
            }
            if (aVar.h() != null) {
                jSONObject.put("advertiser_id", aVar.h());
                jSONObject.put("advertiser_tracking_enabled", !aVar.k());
            }
            if (!aVar.k()) {
                r4.c0 c0Var = r4.c0.f18612a;
                String b7 = r4.c0.b();
                if (!(b7.length() == 0)) {
                    jSONObject.put("ud", b7);
                }
            }
            if (aVar.i() != null) {
                jSONObject.put("installer_package", aVar.i());
            }
        }
    }

    public static final void D0(@NotNull JSONObject jSONObject, @NotNull Context context) throws JSONException {
        Locale locale;
        String language;
        int i7;
        int i8;
        Display display;
        String country;
        PackageInfo packageInfo;
        Intrinsics.checkNotNullParameter(jSONObject, "params");
        Intrinsics.checkNotNullParameter(context, "appContext");
        JSONArray jSONArray = new JSONArray();
        h0 h0Var = f18168a;
        jSONArray.put("a2");
        h0Var.y0(context);
        String packageName = context.getPackageName();
        int i9 = 0;
        int i10 = -1;
        try {
            packageInfo = context.getPackageManager().getPackageInfo(packageName, 0);
        } catch (PackageManager.NameNotFoundException unused) {
        }
        if (packageInfo == null) {
            return;
        }
        i10 = packageInfo.versionCode;
        f18176i = packageInfo.versionName;
        jSONArray.put(packageName);
        jSONArray.put(i10);
        jSONArray.put(f18176i);
        jSONArray.put(Build.VERSION.RELEASE);
        jSONArray.put(Build.MODEL);
        try {
            locale = context.getResources().getConfiguration().locale;
        } catch (Exception unused2) {
            locale = Locale.getDefault();
        }
        f18177j = locale;
        StringBuilder sb = new StringBuilder();
        Locale locale2 = f18177j;
        String str = "";
        if (locale2 == null || (language = locale2.getLanguage()) == null) {
            language = "";
        }
        sb.append(language);
        sb.append('_');
        Locale locale3 = f18177j;
        if (locale3 != null && (country = locale3.getCountry()) != null) {
            str = country;
        }
        sb.append(str);
        jSONArray.put(sb.toString());
        jSONArray.put(f18173f);
        jSONArray.put(f18175h);
        double d7 = 0.0d;
        try {
            display = null;
            if (Build.VERSION.SDK_INT >= 17) {
                Object systemService = context.getSystemService("display");
                DisplayManager displayManager = systemService instanceof DisplayManager ? (DisplayManager) systemService : null;
                if (displayManager != null) {
                    display = displayManager.getDisplay(0);
                }
            } else {
                Object systemService2 = context.getSystemService("window");
                WindowManager windowManager = systemService2 instanceof WindowManager ? (WindowManager) systemService2 : null;
                if (windowManager != null) {
                    display = windowManager.getDefaultDisplay();
                }
            }
        } catch (Exception unused3) {
            i7 = 0;
        }
        if (display == null) {
            i8 = 0;
            jSONArray.put(i9);
            jSONArray.put(i8);
            jSONArray.put(new DecimalFormat("#.##").format(d7));
            jSONArray.put(f18168a.v0());
            jSONArray.put(f18171d);
            jSONArray.put(f18172e);
            jSONArray.put(f18174g);
            jSONObject.put("extinfo", jSONArray.toString());
        }
        DisplayMetrics displayMetrics = new DisplayMetrics();
        display.getMetrics(displayMetrics);
        i7 = displayMetrics.widthPixels;
        try {
            i9 = displayMetrics.heightPixels;
            d7 = displayMetrics.density;
        } catch (Exception unused4) {
        }
        i8 = i9;
        i9 = i7;
        jSONArray.put(i9);
        jSONArray.put(i8);
        jSONArray.put(new DecimalFormat("#.##").format(d7));
        jSONArray.put(f18168a.v0());
        jSONArray.put(f18171d);
        jSONArray.put(f18172e);
        jSONArray.put(f18174g);
        jSONObject.put("extinfo", jSONArray.toString());
    }

    @NotNull
    public static final String E(String str) {
        q4.t tVar = q4.t.f18071a;
        String v6 = q4.t.v();
        return str == null ? v6 : Intrinsics.c(str, "gaming") ? kotlin.text.j.B(v6, "facebook.com", "fb.gg", false, 4, (Object) null) : Intrinsics.c(str, "instagram") ? kotlin.text.j.B(v6, "facebook.com", "instagram.com", false, 4, (Object) null) : v6;
    }

    public static final String E0(@NotNull byte[] bArr) {
        Intrinsics.checkNotNullParameter(bArr, "bytes");
        return f18168a.S("SHA-1", bArr);
    }

    private final GraphRequest F(String str) {
        Bundle bundle = new Bundle();
        bundle.putString("fields", M(B()));
        bundle.putString("access_token", str);
        GraphRequest y6 = GraphRequest.f9241n.y(null, null);
        y6.H(bundle);
        y6.G(HttpMethod.GET);
        return y6;
    }

    public static final String F0(String str) {
        if (str == null) {
            return null;
        }
        return f18168a.R("SHA-256", str);
    }

    public static final void G(@NotNull String str, @NotNull a aVar) {
        Intrinsics.checkNotNullParameter(str, "accessToken");
        Intrinsics.checkNotNullParameter(aVar, "callback");
        d0 d0Var = d0.f18160a;
        JSONObject a7 = d0.a(str);
        if (a7 != null) {
            aVar.a(a7);
            return;
        }
        GraphRequest.b f0Var = new f0(aVar, str);
        GraphRequest F = f18168a.F(str);
        F.D(f0Var);
        F.l();
    }

    public static final void G0(@NotNull Parcel parcel, Map<String, String> map) {
        Intrinsics.checkNotNullParameter(parcel, "parcel");
        if (map == null) {
            parcel.writeInt(-1);
            return;
        }
        parcel.writeInt(map.size());
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            parcel.writeString(key);
            parcel.writeString(value);
        }
    }

    public static final void H(a aVar, String str, q4.z zVar) {
        Intrinsics.checkNotNullParameter(aVar, "$callback");
        Intrinsics.checkNotNullParameter(str, "$accessToken");
        Intrinsics.checkNotNullParameter(zVar, "response");
        if (zVar.b() != null) {
            aVar.b(zVar.b().h());
            return;
        }
        d0 d0Var = d0.f18160a;
        JSONObject d7 = zVar.d();
        if (d7 == null) {
            throw new IllegalStateException("Required value was null.".toString());
        }
        d0.b(str, d7);
        aVar.a(zVar.d());
    }

    public static final void H0(@NotNull Parcel parcel, Map<String, String> map) {
        Intrinsics.checkNotNullParameter(parcel, "parcel");
        if (map == null) {
            parcel.writeInt(-1);
            return;
        }
        parcel.writeInt(map.size());
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            parcel.writeString(key);
            parcel.writeString(value);
        }
    }

    @NotNull
    public static final String J(Context context) {
        i0 i0Var = i0.f18187a;
        i0.j(context, "context");
        q4.t tVar = q4.t.f18071a;
        return q4.t.n();
    }

    public static final Method K(@NotNull Class<?> cls, @NotNull String str, @NotNull Class<?>... clsArr) {
        Intrinsics.checkNotNullParameter(cls, "clazz");
        Intrinsics.checkNotNullParameter(str, "methodName");
        Intrinsics.checkNotNullParameter(clsArr, "parameterTypes");
        try {
            return cls.getMethod(str, (Class[]) Arrays.copyOf(clsArr, clsArr.length));
        } catch (NoSuchMethodException unused) {
            return null;
        }
    }

    public static final Method L(@NotNull String str, @NotNull String str2, @NotNull Class<?>... clsArr) {
        Intrinsics.checkNotNullParameter(str, "className");
        Intrinsics.checkNotNullParameter(str2, "methodName");
        Intrinsics.checkNotNullParameter(clsArr, "parameterTypes");
        try {
            Class<?> cls = Class.forName(str);
            Intrinsics.checkNotNullExpressionValue(cls, "clazz");
            return K(cls, str2, (Class[]) Arrays.copyOf(clsArr, clsArr.length));
        } catch (ClassNotFoundException unused) {
            return null;
        }
    }

    private final String M(String str) {
        return Intrinsics.c(str, "instagram") ? "id,name,profile_picture" : "id,name,first_name,middle_name,last_name";
    }

    public static final Locale N() {
        try {
            q4.t tVar = q4.t.f18071a;
            return q4.t.m().getResources().getConfiguration().locale;
        } catch (Exception unused) {
            return null;
        }
    }

    public static final Object O(@NotNull JSONObject jSONObject, String str, String str2) throws JSONException {
        Intrinsics.checkNotNullParameter(jSONObject, "jsonObject");
        Object opt = jSONObject.opt(str);
        if (opt != null && (opt instanceof String)) {
            opt = new JSONTokener((String) opt).nextValue();
        }
        if (opt == null || (opt instanceof JSONObject) || (opt instanceof JSONArray)) {
            return opt;
        }
        if (str2 == null) {
            throw new FacebookException("Got an unexpected non-JSON object.");
        }
        JSONObject jSONObject2 = new JSONObject();
        jSONObject2.putOpt(str2, opt);
        return jSONObject2;
    }

    private final String Q(MessageDigest messageDigest, byte[] bArr) {
        messageDigest.update(bArr);
        byte[] digest = messageDigest.digest();
        StringBuilder sb = new StringBuilder();
        Intrinsics.checkNotNullExpressionValue(digest, "digest");
        int length = digest.length;
        int i7 = 0;
        while (i7 < length) {
            byte b7 = digest[i7];
            i7++;
            sb.append(Integer.toHexString((b7 >> 4) & 15));
            sb.append(Integer.toHexString((b7 >> 0) & 15));
        }
        String sb2 = sb.toString();
        Intrinsics.checkNotNullExpressionValue(sb2, "builder.toString()");
        return sb2;
    }

    private final String R(String str, String str2) {
        Charset charset = kotlin.text.b.b;
        Objects.requireNonNull(str2, "null cannot be cast to non-null type java.lang.String");
        byte[] bytes = str2.getBytes(charset);
        Intrinsics.checkNotNullExpressionValue(bytes, "(this as java.lang.String).getBytes(charset)");
        return S(str, bytes);
    }

    private final String S(String str, byte[] bArr) {
        try {
            MessageDigest messageDigest = MessageDigest.getInstance(str);
            Intrinsics.checkNotNullExpressionValue(messageDigest, "hash");
            return Q(messageDigest, bArr);
        } catch (NoSuchAlgorithmException unused) {
            return null;
        }
    }

    public static final Object T(Object obj, @NotNull Method method, @NotNull Object... objArr) {
        Intrinsics.checkNotNullParameter(method, "method");
        Intrinsics.checkNotNullParameter(objArr, "args");
        try {
            return method.invoke(obj, Arrays.copyOf(objArr, objArr.length));
        } catch (IllegalAccessException | InvocationTargetException unused) {
            return null;
        }
    }

    public static final boolean U() {
        try {
            Intent intent = new Intent("android.intent.action.VIEW");
            m mVar = m.a;
            q4.t tVar = q4.t.f18071a;
            String format = String.format("fb%s://applinks", Arrays.copyOf(new Object[]{q4.t.n()}, 1));
            Intrinsics.checkNotNullExpressionValue(format, "java.lang.String.format(format, *args)");
            intent.setData(Uri.parse(format));
            Context m7 = q4.t.m();
            PackageManager packageManager = m7.getPackageManager();
            String packageName = m7.getPackageName();
            List<ResolveInfo> queryIntentActivities = packageManager.queryIntentActivities(intent, aen.f10474x);
            Intrinsics.checkNotNullExpressionValue(queryIntentActivities, "packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)");
            Iterator<ResolveInfo> it = queryIntentActivities.iterator();
            while (it.hasNext()) {
                if (Intrinsics.c(packageName, it.next().activityInfo.packageName)) {
                    return true;
                }
            }
        } catch (Exception unused) {
        }
        return false;
    }

    public static final boolean V(@NotNull Context context) {
        AutofillManager autofillManager;
        Intrinsics.checkNotNullParameter(context, "context");
        return Build.VERSION.SDK_INT >= 26 && (autofillManager = (AutofillManager) context.getSystemService(AutofillManager.class)) != null && autofillManager.isAutofillSupported() && autofillManager.isEnabled();
    }

    public static final boolean W(@NotNull Context context) {
        Intrinsics.checkNotNullParameter(context, "context");
        if (Build.VERSION.SDK_INT >= 27) {
            return context.getPackageManager().hasSystemFeature("android.hardware.type.pc");
        }
        String str = Build.DEVICE;
        if (str != null) {
            Intrinsics.checkNotNullExpressionValue(str, "DEVICE");
            if (new Regex(".+_cheets|cheets_.+").matches(str)) {
                return true;
            }
        }
        return false;
    }

    public static final boolean X(Uri uri) {
        return uri != null && kotlin.text.j.s("content", uri.getScheme(), true);
    }

    public static final boolean Y(AccessToken accessToken) {
        return accessToken != null && Intrinsics.c(accessToken, AccessToken.f9149m.e());
    }

    public static final boolean Z() {
        JSONObject C = C();
        if (C == null) {
            return false;
        }
        try {
            JSONArray jSONArray = C.getJSONArray("data_processing_options");
            int length = jSONArray.length();
            if (length > 0) {
                int i7 = 0;
                while (true) {
                    int i8 = i7 + 1;
                    String string = jSONArray.getString(i7);
                    Intrinsics.checkNotNullExpressionValue(string, "options.getString(i)");
                    String lowerCase = string.toLowerCase();
                    Intrinsics.checkNotNullExpressionValue(lowerCase, "(this as java.lang.String).toLowerCase()");
                    if (Intrinsics.c(lowerCase, "ldu")) {
                        return true;
                    }
                    if (i8 >= length) {
                        break;
                    }
                    i7 = i8;
                }
            }
        } catch (Exception unused) {
        }
        return false;
    }

    public static final boolean a0(Uri uri) {
        return uri != null && kotlin.text.j.s("file", uri.getScheme(), true);
    }

    private final boolean b0(Context context) {
        Method L = L("com.google.android.gms.common.GooglePlayServicesUtil", "isGooglePlayServicesAvailable", Context.class);
        if (L == null) {
            return false;
        }
        Object T = T(null, L, context);
        return (T instanceof Integer) && Intrinsics.c(T, 0);
    }

    private final void c(JSONObject jSONObject, q5.a aVar, String str, Context context) {
        if (Build.VERSION.SDK_INT < 31 || !b0(context)) {
            jSONObject.put("anon_id", str);
        } else {
            if (aVar.k()) {
                return;
            }
            jSONObject.put("anon_id", str);
        }
    }

    public static final boolean c0(String str) {
        if (str != null) {
            if (!(str.length() == 0)) {
                return false;
            }
        }
        return true;
    }

    private final void d(JSONObject jSONObject, q5.a aVar, Context context) {
        if (Build.VERSION.SDK_INT < 31 || !b0(context)) {
            jSONObject.put("attribution", aVar.j());
        } else {
            if (aVar.k()) {
                return;
            }
            jSONObject.put("attribution", aVar.j());
        }
    }

    public static final boolean d0(Collection<?> collection) {
        return collection == null || collection.isEmpty();
    }

    public static final <T> boolean e(T t6, T t7) {
        return t6 == null ? t7 == null : Intrinsics.c(t6, t7);
    }

    public static final boolean e0(Uri uri) {
        return uri != null && (kotlin.text.j.s("http", uri.getScheme(), true) || kotlin.text.j.s("https", uri.getScheme(), true) || kotlin.text.j.s("fbstaging", uri.getScheme(), true));
    }

    public static final JSONObject f(@NotNull String str) {
        Intrinsics.checkNotNullParameter(str, "accessToken");
        d0 d0Var = d0.f18160a;
        JSONObject a7 = d0.a(str);
        if (a7 != null) {
            return a7;
        }
        q4.z k7 = f18168a.F(str).k();
        if (k7.b() != null) {
            return null;
        }
        return k7.d();
    }

    @NotNull
    public static final Set<String> f0(@NotNull JSONArray jSONArray) throws JSONException {
        Intrinsics.checkNotNullParameter(jSONArray, "jsonArray");
        HashSet hashSet = new HashSet();
        int length = jSONArray.length();
        if (length > 0) {
            int i7 = 0;
            while (true) {
                int i8 = i7 + 1;
                String string = jSONArray.getString(i7);
                Intrinsics.checkNotNullExpressionValue(string, "jsonArray.getString(i)");
                hashSet.add(string);
                if (i8 >= length) {
                    break;
                }
                i7 = i8;
            }
        }
        return hashSet;
    }

    @NotNull
    public static final Uri g(String str, String str2, Bundle bundle) {
        Uri.Builder builder = new Uri.Builder();
        builder.scheme("https");
        builder.authority(str);
        builder.path(str2);
        if (bundle != null) {
            for (String str3 : bundle.keySet()) {
                Object obj = bundle.get(str3);
                if (obj instanceof String) {
                    builder.appendQueryParameter(str3, (String) obj);
                }
            }
        }
        Uri build = builder.build();
        Intrinsics.checkNotNullExpressionValue(build, "builder.build()");
        return build;
    }

    @NotNull
    public static final List<String> g0(@NotNull JSONArray jSONArray) throws JSONException {
        Intrinsics.checkNotNullParameter(jSONArray, "jsonArray");
        ArrayList arrayList = new ArrayList();
        int length = jSONArray.length();
        if (length > 0) {
            int i7 = 0;
            while (true) {
                int i8 = i7 + 1;
                arrayList.add(jSONArray.getString(i7));
                if (i8 >= length) {
                    break;
                }
                i7 = i8;
            }
        }
        return arrayList;
    }

    private final void h(Context context, String str) {
        CookieSyncManager.createInstance(context).sync();
        CookieManager cookieManager = CookieManager.getInstance();
        String cookie = cookieManager.getCookie(str);
        if (cookie == null) {
            return;
        }
        Object[] array = kotlin.text.j.w0(cookie, new String[]{";"}, false, 0, 6, (Object) null).toArray(new String[0]);
        Objects.requireNonNull(array, "null cannot be cast to non-null type kotlin.Array<T>");
        String[] strArr = (String[]) array;
        int length = strArr.length;
        int i7 = 0;
        while (i7 < length) {
            String str2 = strArr[i7];
            i7++;
            Object[] array2 = kotlin.text.j.w0(str2, new String[]{"="}, false, 0, 6, (Object) null).toArray(new String[0]);
            Objects.requireNonNull(array2, "null cannot be cast to non-null type kotlin.Array<T>");
            String[] strArr2 = (String[]) array2;
            if (strArr2.length > 0) {
                String str3 = strArr2[0];
                int length2 = str3.length() - 1;
                int i8 = 0;
                boolean z6 = false;
                while (i8 <= length2) {
                    boolean z7 = Intrinsics.h(str3.charAt(!z6 ? i8 : length2), 32) <= 0;
                    if (z6) {
                        if (!z7) {
                            break;
                        } else {
                            length2--;
                        }
                    } else if (z7) {
                        i8++;
                    } else {
                        z6 = true;
                    }
                }
                cookieManager.setCookie(str, Intrinsics.n(str3.subSequence(i8, length2 + 1).toString(), "=;expires=Sat, 1 Jan 2000 00:00:01 UTC;"));
            }
        }
        cookieManager.removeExpiredCookie();
    }

    @NotNull
    public static final Map<String, String> h0(@NotNull String str) {
        Intrinsics.checkNotNullParameter(str, "str");
        if (str.length() == 0) {
            return new HashMap();
        }
        try {
            HashMap hashMap = new HashMap();
            JSONObject jSONObject = new JSONObject(str);
            Iterator<String> keys = jSONObject.keys();
            while (keys.hasNext()) {
                String next = keys.next();
                Intrinsics.checkNotNullExpressionValue(next, PListParser.TAG_KEY);
                String string = jSONObject.getString(next);
                Intrinsics.checkNotNullExpressionValue(string, "jsonObject.getString(key)");
                hashMap.put(next, string);
            }
            return hashMap;
        } catch (JSONException unused) {
            return new HashMap();
        }
    }

    public static final void i(@NotNull Context context) {
        Intrinsics.checkNotNullParameter(context, "context");
        try {
            h0 h0Var = f18168a;
            h0Var.h(context, "facebook.com");
            h0Var.h(context, ".facebook.com");
            h0Var.h(context, "https://facebook.com");
            h0Var.h(context, "https://.facebook.com");
        } catch (Exception unused) {
        }
    }

    public static final void i0(String str, Exception exc) {
        q4.t tVar = q4.t.f18071a;
        if (!q4.t.E() || str == null || exc == null) {
            return;
        }
        Log.d(str, exc.getClass().getSimpleName() + ": " + ((Object) exc.getMessage()));
    }

    public static final void j(Closeable closeable) {
        if (closeable == null) {
            return;
        }
        try {
            closeable.close();
        } catch (IOException unused) {
        }
    }

    public static final void j0(String str, String str2) {
        q4.t tVar = q4.t.f18071a;
        if (!q4.t.E() || str == null || str2 == null) {
            return;
        }
        Log.d(str, str2);
    }

    public static final String k(String str, String str2) {
        return c0(str) ? str2 : str;
    }

    public static final void k0(String str, String str2, Throwable th) {
        q4.t tVar = q4.t.f18071a;
        if (!q4.t.E() || c0(str)) {
            return;
        }
        Log.d(str, str2, th);
    }

    private final long l(double d7) {
        return Math.round(d7 / 1.073741824E9d);
    }

    @NotNull
    public static final String l0(@NotNull Map<String, String> map) {
        Intrinsics.checkNotNullParameter(map, "map");
        String str = "";
        if (!map.isEmpty()) {
            try {
                JSONObject jSONObject = new JSONObject();
                for (Map.Entry<String, String> entry : map.entrySet()) {
                    jSONObject.put(entry.getKey(), entry.getValue());
                }
                str = jSONObject.toString();
            } catch (JSONException unused) {
            }
            Intrinsics.checkNotNullExpressionValue(str, "{\n      try {\n        val jsonObject = JSONObject()\n        for ((key, value) in map) {\n          jsonObject.put(key, value)\n        }\n        jsonObject.toString()\n      } catch (_e: JSONException) {\n        \"\"\n      }\n    }");
        }
        return str;
    }

    @NotNull
    public static final List<String> m(@NotNull JSONArray jSONArray) {
        Intrinsics.checkNotNullParameter(jSONArray, "jsonArray");
        try {
            ArrayList arrayList = new ArrayList();
            int i7 = 0;
            int length = jSONArray.length();
            if (length <= 0) {
                return arrayList;
            }
            while (true) {
                int i8 = i7 + 1;
                String string = jSONArray.getString(i7);
                Intrinsics.checkNotNullExpressionValue(string, "jsonArray.getString(i)");
                arrayList.add(string);
                if (i8 >= length) {
                    return arrayList;
                }
                i7 = i8;
            }
        } catch (JSONException unused) {
            return new ArrayList();
        }
    }

    public static final String m0(@NotNull String str) {
        Intrinsics.checkNotNullParameter(str, PListParser.TAG_KEY);
        return f18168a.R("MD5", str);
    }

    @NotNull
    public static final Map<String, Object> n(@NotNull JSONObject jSONObject) {
        Intrinsics.checkNotNullParameter(jSONObject, "jsonObject");
        HashMap hashMap = new HashMap();
        JSONArray names = jSONObject.names();
        if (names == null) {
            return hashMap;
        }
        int i7 = 0;
        int length = names.length();
        if (length > 0) {
            while (true) {
                int i8 = i7 + 1;
                try {
                    String string = names.getString(i7);
                    Intrinsics.checkNotNullExpressionValue(string, "keys.getString(i)");
                    Object obj = jSONObject.get(string);
                    if (obj instanceof JSONObject) {
                        obj = n((JSONObject) obj);
                    }
                    Intrinsics.checkNotNullExpressionValue(obj, "value");
                    hashMap.put(string, obj);
                } catch (JSONException unused) {
                }
                if (i8 >= length) {
                    break;
                }
                i7 = i8;
            }
        }
        return hashMap;
    }

    public static final boolean n0(@NotNull Context context) {
        Intrinsics.checkNotNullParameter(context, "context");
        return V(context);
    }

    @NotNull
    public static final Map<String, String> o(@NotNull JSONObject jSONObject) {
        Intrinsics.checkNotNullParameter(jSONObject, "jsonObject");
        HashMap hashMap = new HashMap();
        Iterator<String> keys = jSONObject.keys();
        while (keys.hasNext()) {
            String next = keys.next();
            String optString = jSONObject.optString(next);
            if (optString != null) {
                Intrinsics.checkNotNullExpressionValue(next, PListParser.TAG_KEY);
                hashMap.put(next, optString);
            }
        }
        return hashMap;
    }

    @NotNull
    public static final Bundle o0(String str) {
        Bundle bundle = new Bundle();
        if (!c0(str)) {
            if (str == null) {
                throw new IllegalStateException("Required value was null.".toString());
            }
            Object[] array = kotlin.text.j.w0(str, new String[]{"&"}, false, 0, 6, (Object) null).toArray(new String[0]);
            Objects.requireNonNull(array, "null cannot be cast to non-null type kotlin.Array<T>");
            String[] strArr = (String[]) array;
            int length = strArr.length;
            int i7 = 0;
            while (i7 < length) {
                String str2 = strArr[i7];
                i7++;
                Object[] array2 = kotlin.text.j.w0(str2, new String[]{"="}, false, 0, 6, (Object) null).toArray(new String[0]);
                Objects.requireNonNull(array2, "null cannot be cast to non-null type kotlin.Array<T>");
                String[] strArr2 = (String[]) array2;
                try {
                    if (strArr2.length == 2) {
                        bundle.putString(URLDecoder.decode(strArr2[0], "UTF-8"), URLDecoder.decode(strArr2[1], "UTF-8"));
                    } else if (strArr2.length == 1) {
                        bundle.putString(URLDecoder.decode(strArr2[0], "UTF-8"), "");
                    }
                } catch (UnsupportedEncodingException e7) {
                    i0("FacebookSDK", e7);
                }
            }
        }
        return bundle;
    }

    public static final int p(InputStream inputStream, @NotNull OutputStream outputStream) throws IOException {
        Intrinsics.checkNotNullParameter(outputStream, "outputStream");
        BufferedInputStream bufferedInputStream = null;
        try {
            BufferedInputStream bufferedInputStream2 = new BufferedInputStream(inputStream);
            try {
                byte[] bArr = new byte[aen.f10471u];
                int i7 = 0;
                while (true) {
                    int read = bufferedInputStream2.read(bArr);
                    if (read == -1) {
                        break;
                    }
                    outputStream.write(bArr, 0, read);
                    i7 += read;
                }
                bufferedInputStream2.close();
                if (inputStream != null) {
                    inputStream.close();
                }
                return i7;
            } catch (Throwable th) {
                th = th;
                bufferedInputStream = bufferedInputStream2;
                if (bufferedInputStream != null) {
                    bufferedInputStream.close();
                }
                if (inputStream != null) {
                    inputStream.close();
                }
                throw th;
            }
        } catch (Throwable th2) {
            th = th2;
        }
    }

    public static final boolean p0(@NotNull Bundle bundle, String str, Object obj) {
        Intrinsics.checkNotNullParameter(bundle, "bundle");
        if (obj == null) {
            bundle.remove(str);
            return true;
        }
        if (obj instanceof Boolean) {
            bundle.putBoolean(str, ((Boolean) obj).booleanValue());
            return true;
        }
        if (obj instanceof boolean[]) {
            bundle.putBooleanArray(str, (boolean[]) obj);
            return true;
        }
        if (obj instanceof Double) {
            bundle.putDouble(str, ((Number) obj).doubleValue());
            return true;
        }
        if (obj instanceof double[]) {
            bundle.putDoubleArray(str, (double[]) obj);
            return true;
        }
        if (obj instanceof Integer) {
            bundle.putInt(str, ((Number) obj).intValue());
            return true;
        }
        if (obj instanceof int[]) {
            bundle.putIntArray(str, (int[]) obj);
            return true;
        }
        if (obj instanceof Long) {
            bundle.putLong(str, ((Number) obj).longValue());
            return true;
        }
        if (obj instanceof long[]) {
            bundle.putLongArray(str, (long[]) obj);
            return true;
        }
        if (obj instanceof String) {
            bundle.putString(str, (String) obj);
            return true;
        }
        if (obj instanceof JSONArray) {
            bundle.putString(str, ((JSONArray) obj).toString());
            return true;
        }
        if (!(obj instanceof JSONObject)) {
            return false;
        }
        bundle.putString(str, ((JSONObject) obj).toString());
        return true;
    }

    public static final void q(URLConnection uRLConnection) {
        if (uRLConnection == null || !(uRLConnection instanceof HttpURLConnection)) {
            return;
        }
        ((HttpURLConnection) uRLConnection).disconnect();
    }

    public static final void q0(@NotNull Bundle bundle, String str, String str2) {
        Intrinsics.checkNotNullParameter(bundle, "b");
        if (c0(str2)) {
            return;
        }
        bundle.putString(str, str2);
    }

    private final boolean r() {
        return Intrinsics.c("mounted", Environment.getExternalStorageState());
    }

    public static final Map<String, String> r0(@NotNull Parcel parcel) {
        Intrinsics.checkNotNullParameter(parcel, "parcel");
        int readInt = parcel.readInt();
        if (readInt < 0) {
            return null;
        }
        HashMap hashMap = new HashMap();
        int i7 = 0;
        if (readInt > 0) {
            do {
                i7++;
                String readString = parcel.readString();
                String readString2 = parcel.readString();
                if (readString != null && readString2 != null) {
                    hashMap.put(readString, readString2);
                }
            } while (i7 < readInt);
        }
        return hashMap;
    }

    @NotNull
    public static final String s(int i7) {
        String bigInteger = new BigInteger(i7 * 5, new Random()).toString(32);
        Intrinsics.checkNotNullExpressionValue(bigInteger, "BigInteger(length * 5, r).toString(32)");
        return bigInteger;
    }

    @NotNull
    public static final String s0(InputStream inputStream) throws IOException {
        BufferedInputStream bufferedInputStream;
        Throwable th;
        InputStreamReader inputStreamReader;
        try {
            bufferedInputStream = new BufferedInputStream(inputStream);
            try {
                inputStreamReader = new InputStreamReader(bufferedInputStream);
                try {
                    StringBuilder sb = new StringBuilder();
                    char[] cArr = new char[aen.f10469s];
                    while (true) {
                        int read = inputStreamReader.read(cArr);
                        if (read == -1) {
                            String sb2 = sb.toString();
                            Intrinsics.checkNotNullExpressionValue(sb2, "{\n      bufferedInputStream = BufferedInputStream(inputStream)\n      reader = InputStreamReader(bufferedInputStream)\n      val stringBuilder = StringBuilder()\n      val bufferSize = 1024 * 2\n      val buffer = CharArray(bufferSize)\n      var n = 0\n      while (reader.read(buffer).also { n = it } != -1) {\n        stringBuilder.append(buffer, 0, n)\n      }\n      stringBuilder.toString()\n    }");
                            j(bufferedInputStream);
                            j(inputStreamReader);
                            return sb2;
                        }
                        sb.append(cArr, 0, read);
                    }
                } catch (Throwable th2) {
                    th = th2;
                    j(bufferedInputStream);
                    j(inputStreamReader);
                    throw th;
                }
            } catch (Throwable th3) {
                th = th3;
                inputStreamReader = null;
            }
        } catch (Throwable th4) {
            bufferedInputStream = null;
            th = th4;
            inputStreamReader = null;
        }
    }

    @NotNull
    public static final String t(Context context) {
        if (context == null) {
            return "null";
        }
        if (context == context.getApplicationContext()) {
            return br.UNKNOWN_CONTENT_TYPE;
        }
        String simpleName = context.getClass().getSimpleName();
        Intrinsics.checkNotNullExpressionValue(simpleName, "{\n      context.javaClass.simpleName\n    }");
        return simpleName;
    }

    public static final Map<String, String> t0(@NotNull Parcel parcel) {
        Intrinsics.checkNotNullParameter(parcel, "parcel");
        int readInt = parcel.readInt();
        if (readInt < 0) {
            return null;
        }
        HashMap hashMap = new HashMap();
        int i7 = 0;
        if (readInt > 0) {
            do {
                i7++;
                hashMap.put(parcel.readString(), parcel.readString());
            } while (i7 < readInt);
        }
        return hashMap;
    }

    @NotNull
    public static final String u(@NotNull Context context) {
        String string;
        Intrinsics.checkNotNullParameter(context, "context");
        try {
            q4.t tVar = q4.t.f18071a;
            String o7 = q4.t.o();
            if (o7 != null) {
                return o7;
            }
            ApplicationInfo applicationInfo = context.getApplicationInfo();
            int i7 = applicationInfo.labelRes;
            if (i7 == 0) {
                string = applicationInfo.nonLocalizedLabel.toString();
            } else {
                string = context.getString(i7);
                Intrinsics.checkNotNullExpressionValue(string, "context.getString(stringId)");
            }
            return string;
        } catch (Exception unused) {
            return "";
        }
    }

    private final void u0() {
        try {
            if (r()) {
                StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
                f18172e = statFs.getAvailableBlocks() * statFs.getBlockSize();
            }
            f18172e = l(f18172e);
        } catch (Exception unused) {
        }
    }

    public static final String v() {
        q4.t tVar = q4.t.f18071a;
        Context m7 = q4.t.m();
        if (m7 == null) {
            return null;
        }
        try {
            PackageInfo packageInfo = m7.getPackageManager().getPackageInfo(m7.getPackageName(), 0);
            if (packageInfo == null) {
                return null;
            }
            return packageInfo.versionName;
        } catch (PackageManager.NameNotFoundException unused) {
            return null;
        }
    }

    private final int v0() {
        int i7 = f18169b;
        if (i7 > 0) {
            return i7;
        }
        try {
            File[] listFiles = new File("/sys/devices/system/cpu/").listFiles((FilenameFilter) g0.a);
            if (listFiles != null) {
                f18169b = listFiles.length;
            }
        } catch (Exception unused) {
        }
        if (f18169b <= 0) {
            f18169b = Math.max(Runtime.getRuntime().availableProcessors(), 1);
        }
        return f18169b;
    }

    public static final boolean w0(File file, String str) {
        return Pattern.matches("cpu[0-9]+", str);
    }

    public static final Date x(Bundle bundle, String str, @NotNull Date date) {
        long parseLong;
        Intrinsics.checkNotNullParameter(date, "dateBase");
        if (bundle == null) {
            return null;
        }
        Object obj = bundle.get(str);
        if (!(obj instanceof Long)) {
            if (obj instanceof String) {
                try {
                    parseLong = Long.parseLong((String) obj);
                } catch (NumberFormatException unused) {
                }
            }
            return null;
        }
        parseLong = ((Number) obj).longValue();
        return parseLong == 0 ? new Date(Long.MAX_VALUE) : new Date(date.getTime() + (parseLong * 1000));
    }

    private final void x0(Context context) {
        if (Intrinsics.c(f18175h, "NoCarrier")) {
            try {
                Object systemService = context.getSystemService("phone");
                if (systemService == null) {
                    throw new NullPointerException("null cannot be cast to non-null type android.telephony.TelephonyManager");
                }
                String networkOperatorName = ((TelephonyManager) systemService).getNetworkOperatorName();
                Intrinsics.checkNotNullExpressionValue(networkOperatorName, "telephonyManager.networkOperatorName");
                f18175h = networkOperatorName;
            } catch (Exception unused) {
            }
        }
    }

    private final void y0(Context context) {
        if (f18170c == -1 || System.currentTimeMillis() - f18170c >= 1800000) {
            f18170c = System.currentTimeMillis();
            z0();
            x0(context);
            A0();
            u0();
        }
    }

    public static final long z(@NotNull Uri uri) {
        Intrinsics.checkNotNullParameter(uri, "contentUri");
        Cursor cursor = null;
        try {
            q4.t tVar = q4.t.f18071a;
            cursor = q4.t.m().getContentResolver().query(uri, null, null, null, null);
            if (cursor == null) {
                return 0L;
            }
            int columnIndex = cursor.getColumnIndex("_size");
            cursor.moveToFirst();
            long j7 = cursor.getLong(columnIndex);
            cursor.close();
            return j7;
        } catch (Throwable th) {
            if (cursor != null) {
                cursor.close();
            }
            throw th;
        }
    }

    private final void z0() {
        try {
            TimeZone timeZone = TimeZone.getDefault();
            String displayName = timeZone.getDisplayName(timeZone.inDaylightTime(new Date()), 0);
            Intrinsics.checkNotNullExpressionValue(displayName, "tz.getDisplayName(tz.inDaylightTime(Date()), TimeZone.SHORT)");
            f18173f = displayName;
            String id = timeZone.getID();
            Intrinsics.checkNotNullExpressionValue(id, "tz.id");
            f18174g = id;
        } catch (AssertionError | Exception unused) {
        }
    }

    @NotNull
    public final String D() {
        return f18174g;
    }

    public final Locale I() {
        return f18177j;
    }

    public final String P() {
        return f18176i;
    }

    public final long w() {
        return f18172e;
    }

    @NotNull
    public final String y() {
        return f18175h;
    }
}