package com.bytedance.geckox.gson;

import com.bytedance.covode.number.Covode;
import com.google.gson.c.a;
import com.google.gson.c.b;
import com.google.gson.c.c;
import com.google.gson.n;
import com.google.gson.u;

public class BooleanTypeAdapter extends u<Boolean> {
    static {
        Covode.recordClassIndex(26471);
    }

    /* renamed from: com.bytedance.geckox.gson.BooleanTypeAdapter$1  reason: invalid class name */
    public static /* synthetic */ class AnonymousClass1 {
        public static final /* synthetic */ int[] LIZ;

        /* JADX WARNING: Can't wrap try/catch for region: R(8:0|1|2|3|4|5|6|8) */
        /* JADX WARNING: Code restructure failed: missing block: B:9:?, code lost:
            return;
         */
        /* JADX WARNING: Failed to process nested try/catch */
        /* JADX WARNING: Missing exception handler attribute for start block: B:3:0x0017 */
        /* JADX WARNING: Missing exception handler attribute for start block: B:5:0x0022 */
        static {
            /*
                r0 = 26472(0x6768, float:3.7095E-41)
                com.bytedance.covode.number.Covode.recordClassIndex(r0)
                com.google.gson.c.b[] r0 = com.google.gson.c.b.values()
                int r0 = r0.length
                int[] r2 = new int[r0]
                LIZ = r2
                com.google.gson.c.b r0 = com.google.gson.c.b.BOOLEAN     // Catch:{ NoSuchFieldError -> 0x0017 }
                int r1 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x0017 }
                r0 = 1
                r2[r1] = r0     // Catch:{ NoSuchFieldError -> 0x0017 }
            L_0x0017:
                int[] r2 = LIZ     // Catch:{ NoSuchFieldError -> 0x0022 }
                com.google.gson.c.b r0 = com.google.gson.c.b.NULL     // Catch:{ NoSuchFieldError -> 0x0022 }
                int r1 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x0022 }
                r0 = 2
                r2[r1] = r0     // Catch:{ NoSuchFieldError -> 0x0022 }
            L_0x0022:
                int[] r2 = LIZ     // Catch:{ NoSuchFieldError -> 0x002d }
                com.google.gson.c.b r0 = com.google.gson.c.b.NUMBER     // Catch:{ NoSuchFieldError -> 0x002d }
                int r1 = r0.ordinal()     // Catch:{ NoSuchFieldError -> 0x002d }
                r0 = 3
                r2[r1] = r0     // Catch:{ NoSuchFieldError -> 0x002d }
            L_0x002d:
                return
            */
            throw new UnsupportedOperationException("Method not decompiled: com.bytedance.geckox.gson.BooleanTypeAdapter.AnonymousClass1.<clinit>():void");
        }
    }

    public /* synthetic */ Object read(a aVar) {
        b LJFF = aVar.LJFF();
        int i = AnonymousClass1.LIZ[LJFF.ordinal()];
        boolean z = true;
        if (i == 1) {
            return Boolean.valueOf(aVar.LJIIIZ());
        }
        if (i == 2) {
            aVar.LJIIJ();
            return null;
        } else if (i == 3) {
            if (aVar.LJIILIIL() == 0) {
                z = false;
            }
            return Boolean.valueOf(z);
        } else {
            throw new n("Expected BOOLEAN or NUMBER but was ".concat(String.valueOf(LJFF)));
        }
    }

    public /* synthetic */ void write(c cVar, Object obj) {
        Boolean bool = (Boolean) obj;
        if (bool == null) {
            cVar.LJFF();
        } else {
            cVar.LIZ(bool.booleanValue());
        }
    }
}
