package defpackage;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

/* JADX INFO: renamed from: ˈᵤʙˁ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public abstract class AbstractC1097 {

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public static final char[] f4671;

    static {
        char[] cArr = new char[80];
        f4671 = cArr;
        Arrays.fill(cArr, ' ');
    }

    /* JADX WARN: Removed duplicated region for block: B:101:0x01f2  */
    /* JADX WARN: Removed duplicated region for block: B:67:0x0180  */
    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static void m3543(AbstractC4729 abstractC4729, StringBuilder sb, int i) {
        int i2;
        int i3;
        boolean zBooleanValue;
        boolean zEquals;
        Method method;
        Method method2;
        HashSet hashSet = new HashSet();
        HashMap map = new HashMap();
        TreeMap treeMap = new TreeMap();
        Method[] declaredMethods = abstractC4729.getClass().getDeclaredMethods();
        int length = declaredMethods.length;
        int i4 = 0;
        while (true) {
            i2 = 3;
            if (i4 >= length) {
                break;
            }
            Method method3 = declaredMethods[i4];
            if (!Modifier.isStatic(method3.getModifiers()) && method3.getName().length() >= 3) {
                if (method3.getName().startsWith("set")) {
                    hashSet.add(method3.getName());
                } else if (Modifier.isPublic(method3.getModifiers()) && method3.getParameterTypes().length == 0) {
                    if (method3.getName().startsWith("has")) {
                        map.put(method3.getName(), method3);
                    } else if (method3.getName().startsWith("get")) {
                        treeMap.put(method3.getName(), method3);
                    }
                }
            }
            i4++;
        }
        for (Map.Entry entry : treeMap.entrySet()) {
            String strSubstring = ((String) entry.getKey()).substring(i2);
            if (!strSubstring.endsWith("List") || strSubstring.endsWith("OrBuilderList") || strSubstring.equals("List") || (method2 = (Method) entry.getValue()) == null) {
                i3 = i2;
            } else {
                i3 = i2;
                if (method2.getReturnType().equals(List.class)) {
                    m3545(sb, i, strSubstring.substring(0, strSubstring.length() - 4), AbstractC4729.m9875(method2, abstractC4729, new Object[0]));
                }
                i2 = i3;
            }
            if (strSubstring.endsWith("Map") && !strSubstring.equals("Map") && (method = (Method) entry.getValue()) != null && method.getReturnType().equals(Map.class) && !method.isAnnotationPresent(Deprecated.class) && Modifier.isPublic(method.getModifiers())) {
                m3545(sb, i, strSubstring.substring(0, strSubstring.length() - 3), AbstractC4729.m9875(method, abstractC4729, new Object[0]));
            } else if (hashSet.contains("set".concat(strSubstring)) && (!strSubstring.endsWith("Bytes") || !treeMap.containsKey("get".concat(strSubstring.substring(0, strSubstring.length() - 5))))) {
                Method method4 = (Method) entry.getValue();
                Method method5 = (Method) map.get("has".concat(strSubstring));
                if (method4 != null) {
                    Object objM9875 = AbstractC4729.m9875(method4, abstractC4729, new Object[0]);
                    if (method5 != null) {
                        zBooleanValue = ((Boolean) AbstractC4729.m9875(method5, abstractC4729, new Object[0])).booleanValue();
                    } else if (objM9875 instanceof Boolean) {
                        zBooleanValue = ((Boolean) objM9875).booleanValue();
                    } else if (objM9875 instanceof Integer) {
                        if (((Integer) objM9875).intValue() == 0) {
                        }
                    } else if (objM9875 instanceof Float) {
                        if (Float.floatToRawIntBits(((Float) objM9875).floatValue()) == 0) {
                        }
                    } else if (!(objM9875 instanceof Double)) {
                        if (objM9875 instanceof String) {
                            zEquals = objM9875.equals("");
                        } else if (objM9875 instanceof AbstractC4667) {
                            zEquals = objM9875.equals(AbstractC4667.f17732);
                        } else if (!(objM9875 instanceof AbstractC3365) ? !(objM9875 instanceof Enum) || ((Enum) objM9875).ordinal() != 0 : objM9875 != ((AbstractC4729) ((AbstractC4729) ((AbstractC3365) objM9875)).mo1186(6))) {
                        }
                        if (zEquals) {
                        }
                    } else if (Double.doubleToRawLongBits(((Double) objM9875).doubleValue()) == 0) {
                    }
                    if (zBooleanValue) {
                        m3545(sb, i, strSubstring, objM9875);
                    }
                }
            }
            i2 = i3;
        }
        C0882 c0882 = abstractC4729.zzc;
        if (c0882 != null) {
            for (int i5 = 0; i5 < c0882.f3897; i5++) {
                m3545(sb, i, String.valueOf(c0882.f3894[i5] >>> 3), c0882.f3895[i5]);
            }
        }
    }

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public static void m3544(int i, StringBuilder sb) {
        while (i > 0) {
            int i2 = 80;
            if (i <= 80) {
                i2 = i;
            }
            sb.append(f4671, 0, i2);
            i -= i2;
        }
    }

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public static void m3545(StringBuilder sb, int i, String str, Object obj) {
        String strReplace;
        if (obj instanceof List) {
            Iterator it = ((List) obj).iterator();
            while (it.hasNext()) {
                m3545(sb, i, str, it.next());
            }
            return;
        }
        if (obj instanceof Map) {
            Iterator it2 = ((Map) obj).entrySet().iterator();
            while (it2.hasNext()) {
                m3545(sb, i, str, (Map.Entry) it2.next());
            }
            return;
        }
        sb.append('\n');
        m3544(i, sb);
        if (!str.isEmpty()) {
            StringBuilder sb2 = new StringBuilder();
            sb2.append(Character.toLowerCase(str.charAt(0)));
            for (int i2 = 1; i2 < str.length(); i2++) {
                char cCharAt = str.charAt(i2);
                if (Character.isUpperCase(cCharAt)) {
                    sb2.append("_");
                }
                sb2.append(Character.toLowerCase(cCharAt));
            }
            str = sb2.toString();
        }
        sb.append(str);
        if (!(obj instanceof String)) {
            if (obj instanceof AbstractC4667) {
                sb.append(": \"");
                sb.append(ᵴᵧˈ.ˌᴵ(((AbstractC4667) obj).m9797()));
                sb.append('\"');
                return;
            }
            if (obj instanceof AbstractC4729) {
                sb.append(" {");
                m3543((AbstractC4729) obj, sb, i + 2);
                sb.append("\n");
                m3544(i, sb);
                sb.append("}");
                return;
            }
            if (!(obj instanceof Map.Entry)) {
                sb.append(": ");
                sb.append(obj);
                return;
            }
            int i3 = i + 2;
            sb.append(" {");
            Map.Entry entry = (Map.Entry) obj;
            m3545(sb, i3, "key", entry.getKey());
            m3545(sb, i3, "value", entry.getValue());
            sb.append("\n");
            m3544(i, sb);
            sb.append("}");
            return;
        }
        sb.append(": \"");
        String strReplace2 = (String) obj;
        boolean z = false;
        boolean z2 = false;
        boolean z3 = false;
        for (int i4 = 0; i4 < strReplace2.length(); i4++) {
            char cCharAt2 = strReplace2.charAt(i4);
            if (cCharAt2 < ' ' || cCharAt2 > '~') {
                strReplace = ᵴᵧˈ.ˌᴵ(strReplace2.getBytes(StandardCharsets.UTF_8));
                break;
            }
            if (cCharAt2 == '\"') {
                z3 = true;
            } else if (cCharAt2 == '\'') {
                z2 = true;
            } else if (cCharAt2 == '\\') {
                z = true;
            }
        }
        if (z) {
            strReplace2 = strReplace2.replace("\\", "\\\\");
        }
        strReplace = z2 ? strReplace2.replace("'", "\\'") : strReplace2;
        if (z3) {
            strReplace = strReplace.replace("\"", "\\\"");
        }
        sb.append(strReplace);
        sb.append('\"');
    }
}
