package org.joda.time.chrono;

import java.util.concurrent.ConcurrentHashMap;
import org.joda.time.DateTimeFieldType;
import org.joda.time.DateTimeZone;
import org.joda.time.IllegalFieldValueException;
import org.joda.time.chrono.AssembledChronology;
import org.joda.time.field.SkipDateTimeField;

/* loaded from: classes5.dex */
public final class JulianChronology extends BasicGJChronology {
    private static final long serialVersionUID = -8731039522547897247L;

    /* renamed from: x0, reason: collision with root package name */
    private static final ConcurrentHashMap f31983x0 = new ConcurrentHashMap();

    /* renamed from: w0, reason: collision with root package name */
    private static final JulianChronology f31982w0 = M0(DateTimeZone.f31852p);

    JulianChronology(org.joda.time.a aVar, Object obj, int i10) {
        super(aVar, obj, i10);
    }

    static int L0(int i10) {
        if (i10 > 0) {
            return i10;
        }
        if (i10 != 0) {
            return i10 + 1;
        }
        throw new IllegalFieldValueException(DateTimeFieldType.U(), Integer.valueOf(i10), null, null);
    }

    public static JulianChronology M0(DateTimeZone dateTimeZone) {
        return N0(dateTimeZone, 4);
    }

    public static JulianChronology N0(DateTimeZone dateTimeZone, int i10) {
        if (dateTimeZone == null) {
            dateTimeZone = DateTimeZone.k();
        }
        ConcurrentHashMap concurrentHashMap = f31983x0;
        JulianChronology[] julianChronologyArr = (JulianChronology[]) concurrentHashMap.get(dateTimeZone);
        if (julianChronologyArr == null) {
            julianChronologyArr = new JulianChronology[7];
            JulianChronology[] julianChronologyArr2 = (JulianChronology[]) concurrentHashMap.putIfAbsent(dateTimeZone, julianChronologyArr);
            if (julianChronologyArr2 != null) {
                julianChronologyArr = julianChronologyArr2;
            }
        }
        int i11 = i10 - 1;
        try {
            JulianChronology julianChronology = julianChronologyArr[i11];
            if (julianChronology == null) {
                synchronized (julianChronologyArr) {
                    julianChronology = julianChronologyArr[i11];
                    if (julianChronology == null) {
                        DateTimeZone dateTimeZone2 = DateTimeZone.f31852p;
                        JulianChronology julianChronology2 = dateTimeZone == dateTimeZone2 ? new JulianChronology(null, null, i10) : new JulianChronology(ZonedChronology.V(N0(dateTimeZone2, i10), dateTimeZone), null, i10);
                        julianChronologyArr[i11] = julianChronology2;
                        julianChronology = julianChronology2;
                    }
                }
            }
            return julianChronology;
        } catch (ArrayIndexOutOfBoundsException unused) {
            throw new IllegalArgumentException("Invalid min days in first week: " + i10);
        }
    }

    private Object readResolve() {
        org.joda.time.a Q = Q();
        int u02 = u0();
        if (u02 == 0) {
            u02 = 4;
        }
        return Q == null ? N0(DateTimeZone.f31852p, u02) : N0(Q.m(), u02);
    }

    @Override // org.joda.time.a
    public org.joda.time.a J() {
        return f31982w0;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // org.joda.time.chrono.BasicChronology
    public boolean J0(int i10) {
        return (i10 & 3) == 0;
    }

    @Override // org.joda.time.a
    public org.joda.time.a K(DateTimeZone dateTimeZone) {
        if (dateTimeZone == null) {
            dateTimeZone = DateTimeZone.k();
        }
        return dateTimeZone == m() ? this : M0(dateTimeZone);
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // org.joda.time.chrono.BasicChronology, org.joda.time.chrono.AssembledChronology
    public void P(AssembledChronology.a aVar) {
        if (Q() == null) {
            super.P(aVar);
            aVar.E = new SkipDateTimeField(this, aVar.E);
            aVar.B = new SkipDateTimeField(this, aVar.B);
        }
    }

    @Override // org.joda.time.chrono.BasicChronology
    long V(int i10) {
        int i11;
        int i12 = i10 - 1968;
        if (i12 <= 0) {
            i11 = (i12 + 3) >> 2;
        } else {
            int i13 = i12 >> 2;
            i11 = !J0(i10) ? i13 + 1 : i13;
        }
        return (((i12 * 365) + i11) * 86400000) - 62035200000L;
    }

    @Override // org.joda.time.chrono.BasicChronology
    long W() {
        return 31083663600000L;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // org.joda.time.chrono.BasicChronology
    public long X() {
        return 2629800000L;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // org.joda.time.chrono.BasicChronology
    public long Y() {
        return 31557600000L;
    }

    @Override // org.joda.time.chrono.BasicChronology
    long Z() {
        return 15778800000L;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // org.joda.time.chrono.BasicChronology
    public long a0(int i10, int i11, int i12) {
        return super.a0(L0(i10), i11, i12);
    }

    @Override // org.joda.time.chrono.BasicChronology
    public /* bridge */ /* synthetic */ boolean equals(Object obj) {
        return super.equals(obj);
    }

    @Override // org.joda.time.chrono.BasicChronology
    public /* bridge */ /* synthetic */ int hashCode() {
        return super.hashCode();
    }

    @Override // org.joda.time.chrono.BasicChronology, org.joda.time.chrono.AssembledChronology, org.joda.time.chrono.BaseChronology, org.joda.time.a
    public /* bridge */ /* synthetic */ long k(int i10, int i11, int i12, int i13) {
        return super.k(i10, i11, i12, i13);
    }

    @Override // org.joda.time.chrono.BasicChronology, org.joda.time.chrono.AssembledChronology, org.joda.time.chrono.BaseChronology, org.joda.time.a
    public /* bridge */ /* synthetic */ long l(int i10, int i11, int i12, int i13, int i14, int i15, int i16) {
        return super.l(i10, i11, i12, i13, i14, i15, i16);
    }

    @Override // org.joda.time.chrono.BasicChronology, org.joda.time.chrono.AssembledChronology, org.joda.time.a
    public /* bridge */ /* synthetic */ DateTimeZone m() {
        return super.m();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // org.joda.time.chrono.BasicChronology
    public int r0() {
        return 292272992;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // org.joda.time.chrono.BasicChronology
    public int t0() {
        return -292269054;
    }

    @Override // org.joda.time.chrono.BasicChronology, org.joda.time.a
    public /* bridge */ /* synthetic */ String toString() {
        return super.toString();
    }

    @Override // org.joda.time.chrono.BasicChronology
    public /* bridge */ /* synthetic */ int u0() {
        return super.u0();
    }
}
