package K.K.K.ʬ;

import android.text.TextUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import K.K.K.ῲ.C2372;

/* renamed from: K.K.K.ʬ.ʬ  reason: contains not printable characters */
public class C2367 {
    /* renamed from: K  reason: contains not printable characters */
    public static JSONArray m6263(Object obj) {
        int i = 0;
        if (obj instanceof int[]) {
            JSONArray jSONArray = new JSONArray();
            int[] iArr = (int[]) obj;
            while (i < iArr.length) {
                jSONArray.put(i, iArr[i]);
                i++;
            }
            return jSONArray;
        } else if (obj instanceof String[]) {
            JSONArray jSONArray2 = new JSONArray();
            String[] strArr = (String[]) obj;
            while (i < strArr.length) {
                jSONArray2.put(i, strArr[i]);
                i++;
            }
            return jSONArray2;
        } else if (obj instanceof float[]) {
            JSONArray jSONArray3 = new JSONArray();
            float[] fArr = (float[]) obj;
            while (i < fArr.length) {
                jSONArray3.put(i, (double) fArr[i]);
                i++;
            }
            return jSONArray3;
        } else if (obj instanceof double[]) {
            JSONArray jSONArray4 = new JSONArray();
            double[] dArr = (double[]) obj;
            while (i < dArr.length) {
                jSONArray4.put(i, dArr[i]);
                i++;
            }
            return jSONArray4;
        } else if (obj instanceof Object[]) {
            JSONArray jSONArray5 = new JSONArray();
            Object[] objArr = (Object[]) obj;
            while (i < objArr.length) {
                jSONArray5.put(i, objArr[i]);
                i++;
            }
            return jSONArray5;
        } else if (!(obj instanceof Iterable)) {
            return null;
        } else {
            JSONArray jSONArray6 = new JSONArray();
            for (Object obj2 : (Iterable) obj) {
                jSONArray6.put(obj2);
            }
            return jSONArray6;
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:15:0x005f  */
    /* JADX WARNING: Removed duplicated region for block: B:9:0x0017 A[SYNTHETIC, Splitter:B:9:0x0017] */
    /* renamed from: K  reason: contains not printable characters */
    public static <T extends C2372> T m6264(String str, Class<? extends T> cls) {
        T t;
        try {
            t = (T) ((C2372) cls.newInstance());
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e2) {
            e2.printStackTrace();
        }
        if (m6265(str)) {
            try {
                JSONObject jSONObject = new JSONObject(str);
                String optString = jSONObject.optString("code");
                t.f8209 = optString.equals("SUCCESS");
                t.f8212 = optString;
                t.f8213 = jSONObject.optString("extra");
                t.f8214 = jSONObject.optString("message");
                t.f8216 = jSONObject.optString("transactionId");
                t.f8211 = jSONObject.optString("pricingStrategy");
                t.f8215 = jSONObject.optString("data");
            } catch (JSONException e3) {
                e3.getMessage();
            }
        }
        if (TextUtils.isEmpty(str)) {
            t.f8212 = "NO_RESPONSE";
            t.f8214 = "NO_RESPONSE".toLowerCase();
        }
        return t;
        t = null;
        if (m6265(str)) {
        }
        if (TextUtils.isEmpty(str)) {
        }
        return t;
    }

    /* renamed from: K  reason: contains not printable characters */
    public static boolean m6265(String str) {
        return !TextUtils.isEmpty(str) && str.startsWith("{") && str.endsWith("}");
    }
}
