package org.joda.time.chrono;

import java.util.concurrent.ConcurrentHashMap;
import org.joda.time.DateTimeZone;
import org.joda.time.chrono.AssembledChronology;

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

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

    /* renamed from: w0, reason: collision with root package name */
    private static final GregorianChronology f31978w0 = L0(DateTimeZone.f31852p);

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

    public static GregorianChronology L0(DateTimeZone dateTimeZone) {
        return M0(dateTimeZone, 4);
    }

    public static GregorianChronology M0(DateTimeZone dateTimeZone, int i10) {
        if (dateTimeZone == null) {
            dateTimeZone = DateTimeZone.k();
        }
        ConcurrentHashMap concurrentHashMap = f31979x0;
        GregorianChronology[] gregorianChronologyArr = (GregorianChronology[]) concurrentHashMap.get(dateTimeZone);
        if (gregorianChronologyArr == null) {
            gregorianChronologyArr = new GregorianChronology[7];
            GregorianChronology[] gregorianChronologyArr2 = (GregorianChronology[]) concurrentHashMap.putIfAbsent(dateTimeZone, gregorianChronologyArr);
            if (gregorianChronologyArr2 != null) {
                gregorianChronologyArr = gregorianChronologyArr2;
            }
        }
        int i11 = i10 - 1;
        try {
            GregorianChronology gregorianChronology = gregorianChronologyArr[i11];
            if (gregorianChronology == null) {
                synchronized (gregorianChronologyArr) {
                    gregorianChronology = gregorianChronologyArr[i11];
                    if (gregorianChronology == null) {
                        DateTimeZone dateTimeZone2 = DateTimeZone.f31852p;
                        GregorianChronology gregorianChronology2 = dateTimeZone == dateTimeZone2 ? new GregorianChronology(null, null, i10) : new GregorianChronology(ZonedChronology.V(M0(dateTimeZone2, i10), dateTimeZone), null, i10);
                        gregorianChronologyArr[i11] = gregorianChronology2;
                        gregorianChronology = gregorianChronology2;
                    }
                }
            }
            return gregorianChronology;
        } catch (ArrayIndexOutOfBoundsException unused) {
            throw new IllegalArgumentException("Invalid min days in first week: " + i10);
        }
    }

    public static GregorianChronology N0() {
        return f31978w0;
    }

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

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

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

    @Override // org.joda.time.a
    public org.joda.time.a K(DateTimeZone dateTimeZone) {
        if (dateTimeZone == null) {
            dateTimeZone = DateTimeZone.k();
        }
        return dateTimeZone == m() ? this : L0(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);
        }
    }

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

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

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

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

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

    @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 292278993;
    }

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

    @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();
    }
}
