what-the-bank/sources/o/gsX.java

1298 lines
50 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.io.BufferedReader;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Serializable;
import java.text.ParseException;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.bouncycastle.crypto.tls.CipherSuite;
import org.threeten.bp.DateTimeException;
import org.threeten.bp.temporal.UnsupportedTemporalTypeException;
/* loaded from: classes6.dex */
public final class gsX extends gsK<gsX> implements Serializable {
private static final Long[] ADJUSTED_CYCLES;
private static final HashMap<Integer, Integer[]> ADJUSTED_CYCLE_YEARS;
private static final Integer[] ADJUSTED_LEAST_MAX_VALUES;
private static final Integer[] ADJUSTED_MAX_VALUES;
private static final Integer[] ADJUSTED_MIN_VALUES;
private static final HashMap<Integer, Integer[]> ADJUSTED_MONTH_DAYS;
private static final HashMap<Integer, Integer[]> ADJUSTED_MONTH_LENGTHS;
private static final String DEFAULT_CONFIG_FILENAME = "hijrah_deviation.cfg";
private static final String DEFAULT_CONFIG_PATH;
private static final Integer[] DEFAULT_CYCLE_YEARS;
private static final Integer[] DEFAULT_LEAP_MONTH_DAYS;
private static final Integer[] DEFAULT_LEAP_MONTH_LENGTHS;
private static final Integer[] DEFAULT_MONTH_DAYS;
private static final Integer[] DEFAULT_MONTH_LENGTHS;
private static final char FILE_SEP;
private static final int HIJRAH_JAN_1_1_GREGORIAN_DAY = -492148;
private static final int MAX_ADJUSTED_CYCLE = 334;
public static final int MIN_VALUE_OF_ERA = 1;
private static final String PATH_SEP;
private static final int POSITION_DAY_OF_MONTH = 5;
private static final int POSITION_DAY_OF_YEAR = 6;
private static final long serialVersionUID = -5207853542612002020L;
private final transient int dayOfMonth;
private final transient EnumC15515gsk dayOfWeek;
private final transient int dayOfYear;
private final transient EnumC15504gsZ era;
private final long gregorianEpochDay;
private final transient boolean isLeapYear;
private final transient int monthOfYear;
private final transient int yearOfEra;
private static final int[] NUM_DAYS = {0, 30, 59, 89, 118, CipherSuite.TLS_RSA_PSK_WITH_AES_128_CBC_SHA, CipherSuite.TLS_PSK_WITH_NULL_SHA384, 207, 236, 266, 295, 325};
private static final int[] LEAP_NUM_DAYS = {0, 30, 59, 89, 118, CipherSuite.TLS_RSA_PSK_WITH_AES_128_CBC_SHA, CipherSuite.TLS_PSK_WITH_NULL_SHA384, 207, 236, 266, 295, 325};
private static final int[] MONTH_LENGTH = {30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29};
private static final int[] LEAP_MONTH_LENGTH = {30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 30};
private static final int[] MIN_VALUES = {0, 1, 0, 1, 0, 1, 1};
public static final int MAX_VALUE_OF_ERA = 9999;
private static final int[] LEAST_MAX_VALUES = {1, MAX_VALUE_OF_ERA, 11, 51, 5, 29, 354};
private static final int[] MAX_VALUES = {1, MAX_VALUE_OF_ERA, 11, 52, 6, 30, 355};
private static final int[] CYCLEYEAR_START_DATE = {0, 354, 709, 1063, 1417, 1772, 2126, 2481, 2835, 3189, 3544, 3898, 4252, 4607, 4961, 5315, 5670, 6024, 6379, 6733, 7087, 7442, 7796, 8150, 8505, 8859, 9214, 9568, 9922, 10277};
@Override // o.gsK, o.InterfaceC15536gtL
public final /* bridge */ /* synthetic */ long until(InterfaceC15536gtL interfaceC15536gtL, InterfaceC15539gtV interfaceC15539gtV) {
return super.until(interfaceC15536gtL, interfaceC15539gtV);
}
@Override // o.gsK, o.gsJ
public final /* bridge */ /* synthetic */ gsT until(gsJ gsj) {
return super.until(gsj);
}
static {
char c = File.separatorChar;
FILE_SEP = c;
PATH_SEP = File.pathSeparator;
StringBuilder sb = new StringBuilder("org");
sb.append(c);
sb.append("threeten");
sb.append(c);
sb.append("bp");
sb.append(c);
sb.append("chrono");
DEFAULT_CONFIG_PATH = sb.toString();
ADJUSTED_MONTH_DAYS = new HashMap<>();
ADJUSTED_MONTH_LENGTHS = new HashMap<>();
ADJUSTED_CYCLE_YEARS = new HashMap<>();
DEFAULT_MONTH_DAYS = new Integer[12];
int i = 0;
int i2 = 0;
while (true) {
int[] iArr = NUM_DAYS;
if (i2 >= iArr.length) {
break;
}
DEFAULT_MONTH_DAYS[i2] = Integer.valueOf(iArr[i2]);
i2++;
}
DEFAULT_LEAP_MONTH_DAYS = new Integer[LEAP_NUM_DAYS.length];
int i3 = 0;
while (true) {
int[] iArr2 = LEAP_NUM_DAYS;
if (i3 >= iArr2.length) {
break;
}
DEFAULT_LEAP_MONTH_DAYS[i3] = Integer.valueOf(iArr2[i3]);
i3++;
}
DEFAULT_MONTH_LENGTHS = new Integer[MONTH_LENGTH.length];
int i4 = 0;
while (true) {
int[] iArr3 = MONTH_LENGTH;
if (i4 >= iArr3.length) {
break;
}
DEFAULT_MONTH_LENGTHS[i4] = Integer.valueOf(iArr3[i4]);
i4++;
}
DEFAULT_LEAP_MONTH_LENGTHS = new Integer[LEAP_MONTH_LENGTH.length];
int i5 = 0;
while (true) {
int[] iArr4 = LEAP_MONTH_LENGTH;
if (i5 >= iArr4.length) {
break;
}
DEFAULT_LEAP_MONTH_LENGTHS[i5] = Integer.valueOf(iArr4[i5]);
i5++;
}
DEFAULT_CYCLE_YEARS = new Integer[CYCLEYEAR_START_DATE.length];
int i6 = 0;
while (true) {
int[] iArr5 = CYCLEYEAR_START_DATE;
if (i6 >= iArr5.length) {
break;
}
DEFAULT_CYCLE_YEARS[i6] = Integer.valueOf(iArr5[i6]);
i6++;
}
ADJUSTED_CYCLES = new Long[MAX_ADJUSTED_CYCLE];
int i7 = 0;
while (true) {
Long[] lArr = ADJUSTED_CYCLES;
if (i7 >= lArr.length) {
break;
}
lArr[i7] = Long.valueOf(i7 * 10631);
i7++;
}
ADJUSTED_MIN_VALUES = new Integer[MIN_VALUES.length];
int i8 = 0;
while (true) {
int[] iArr6 = MIN_VALUES;
if (i8 >= iArr6.length) {
break;
}
ADJUSTED_MIN_VALUES[i8] = Integer.valueOf(iArr6[i8]);
i8++;
}
ADJUSTED_LEAST_MAX_VALUES = new Integer[LEAST_MAX_VALUES.length];
int i9 = 0;
while (true) {
int[] iArr7 = LEAST_MAX_VALUES;
if (i9 >= iArr7.length) {
break;
}
ADJUSTED_LEAST_MAX_VALUES[i9] = Integer.valueOf(iArr7[i9]);
i9++;
}
ADJUSTED_MAX_VALUES = new Integer[MAX_VALUES.length];
while (true) {
int[] iArr8 = MAX_VALUES;
if (i < iArr8.length) {
ADJUSTED_MAX_VALUES[i] = Integer.valueOf(iArr8[i]);
i++;
} else {
try {
readDeviationConfig();
return;
} catch (IOException | ParseException unused) {
return;
}
}
}
}
public static gsX now() {
return now(AbstractC15514gsj.systemDefaultZone());
}
public static gsX now(AbstractC15502gsH abstractC15502gsH) {
return now(AbstractC15514gsj.system(abstractC15502gsH));
}
public static gsX now(AbstractC15514gsj abstractC15514gsj) {
return C15540gta.INSTANCE.dateNow(abstractC15514gsj);
}
public static gsX of(int i, int i2, int i3) {
if (i > 0) {
return of(EnumC15504gsZ.AH, i, i2, i3);
}
return of(EnumC15504gsZ.BEFORE_AH, 1 - i, i2, i3);
}
static gsX of(EnumC15504gsZ enumC15504gsZ, int i, int i2, int i3) {
gtG.requireNonNull(enumC15504gsZ, "era");
checkValidYearOfEra(i);
checkValidMonth(i2);
checkValidDayOfMonth(i3);
return new gsX(getGregorianEpochDay(enumC15504gsZ.prolepticYear(i), i2, i3));
}
private static void checkValidYearOfEra(int i) {
if (i <= 0 || i > 9999) {
throw new DateTimeException("Invalid year of Hijrah Era");
}
}
private static void checkValidDayOfYear(int i) {
if (i <= 0 || i > getMaximumDayOfYear()) {
throw new DateTimeException("Invalid day of year of Hijrah date");
}
}
private static void checkValidMonth(int i) {
if (i <= 0 || i > 12) {
throw new DateTimeException("Invalid month of Hijrah date");
}
}
private static void checkValidDayOfMonth(int i) {
if (i <= 0 || i > getMaximumDayOfMonth()) {
StringBuilder sb = new StringBuilder("Invalid day of month of Hijrah date, day ");
sb.append(i);
sb.append(" greater than ");
sb.append(getMaximumDayOfMonth());
sb.append(" or less than 1");
throw new DateTimeException(sb.toString());
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public static gsX of(C15520gsp c15520gsp) {
return new gsX(c15520gsp.toEpochDay());
}
/* JADX INFO: Access modifiers changed from: package-private */
public static gsX ofEpochDay(long j) {
return new gsX(j);
}
public static gsX from(gtK gtk) {
return C15540gta.INSTANCE.date(gtk);
}
private gsX(long j) {
int[] hijrahDateInfo = getHijrahDateInfo(j);
checkValidYearOfEra(hijrahDateInfo[1]);
checkValidMonth(hijrahDateInfo[2]);
checkValidDayOfMonth(hijrahDateInfo[3]);
checkValidDayOfYear(hijrahDateInfo[4]);
this.era = EnumC15504gsZ.of(hijrahDateInfo[0]);
int i = hijrahDateInfo[1];
this.yearOfEra = i;
this.monthOfYear = hijrahDateInfo[2];
this.dayOfMonth = hijrahDateInfo[3];
this.dayOfYear = hijrahDateInfo[4];
this.dayOfWeek = EnumC15515gsk.of(hijrahDateInfo[5]);
this.gregorianEpochDay = j;
this.isLeapYear = isLeapYear(i);
}
private Object readResolve() {
return new gsX(this.gregorianEpochDay);
}
@Override // o.gsJ
public final C15540gta getChronology() {
return C15540gta.INSTANCE;
}
@Override // o.gtE, o.gtK
public final gtT range(InterfaceC15537gtP interfaceC15537gtP) {
if (interfaceC15537gtP instanceof EnumC15534gtD) {
if (isSupported(interfaceC15537gtP)) {
EnumC15534gtD enumC15534gtD = (EnumC15534gtD) interfaceC15537gtP;
int i = AnonymousClass3.$SwitchMap$org$threeten$bp$temporal$ChronoField[enumC15534gtD.ordinal()];
if (i == 1) {
return gtT.of(1L, lengthOfMonth());
}
if (i == 2) {
return gtT.of(1L, lengthOfYear());
}
if (i == 3) {
return gtT.of(1L, 5L);
}
if (i == 4) {
return gtT.of(1L, 1000L);
}
return getChronology().range(enumC15534gtD);
}
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(String.valueOf(interfaceC15537gtP)));
}
return interfaceC15537gtP.rangeRefinedBy(this);
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: o.gsX$3, reason: invalid class name */
/* loaded from: classes6.dex */
public static /* synthetic */ class AnonymousClass3 {
static final int[] $SwitchMap$org$threeten$bp$temporal$ChronoField;
static {
int[] iArr = new int[EnumC15534gtD.values().length];
$SwitchMap$org$threeten$bp$temporal$ChronoField = iArr;
try {
iArr[EnumC15534gtD.DAY_OF_MONTH.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.DAY_OF_YEAR.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.ALIGNED_WEEK_OF_MONTH.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.YEAR_OF_ERA.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.DAY_OF_WEEK.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_MONTH.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
$SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_YEAR.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
$SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.EPOCH_DAY.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
try {
$SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.ALIGNED_WEEK_OF_YEAR.ordinal()] = 9;
} catch (NoSuchFieldError unused9) {
}
try {
$SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.MONTH_OF_YEAR.ordinal()] = 10;
} catch (NoSuchFieldError unused10) {
}
try {
$SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.YEAR.ordinal()] = 11;
} catch (NoSuchFieldError unused11) {
}
try {
$SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.ERA.ordinal()] = 12;
} catch (NoSuchFieldError unused12) {
}
}
}
/* JADX WARN: Failed to find 'out' block for switch in B:4:0x000f. Please report as an issue. */
@Override // o.gtK
public final long getLong(InterfaceC15537gtP interfaceC15537gtP) {
int i;
int i2;
if (interfaceC15537gtP instanceof EnumC15534gtD) {
switch (AnonymousClass3.$SwitchMap$org$threeten$bp$temporal$ChronoField[((EnumC15534gtD) interfaceC15537gtP).ordinal()]) {
case 1:
i = this.dayOfMonth;
return i;
case 2:
i = this.dayOfYear;
return i;
case 3:
i2 = (this.dayOfMonth - 1) / 7;
i = i2 + 1;
return i;
case 4:
i = this.yearOfEra;
return i;
case 5:
i = this.dayOfWeek.getValue();
return i;
case 6:
i2 = (this.dayOfMonth - 1) % 7;
i = i2 + 1;
return i;
case 7:
i2 = (this.dayOfYear - 1) % 7;
i = i2 + 1;
return i;
case 8:
return toEpochDay();
case 9:
i2 = (this.dayOfYear - 1) / 7;
i = i2 + 1;
return i;
case 10:
i = this.monthOfYear;
return i;
case 11:
i = this.yearOfEra;
return i;
case 12:
i = this.era.getValue();
return i;
default:
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(String.valueOf(interfaceC15537gtP)));
}
}
return interfaceC15537gtP.getFrom(this);
}
@Override // o.gsJ, o.AbstractC15535gtF, o.InterfaceC15536gtL
public final gsX with(gtJ gtj) {
return (gsX) super.with(gtj);
}
/* JADX WARN: Type inference failed for: r5v14, types: [o.gsX] */
/* JADX WARN: Type inference failed for: r5v16, types: [o.gsX] */
/* JADX WARN: Type inference failed for: r5v18, types: [o.gsX] */
/* JADX WARN: Type inference failed for: r5v21, types: [o.gsX] */
/* JADX WARN: Type inference failed for: r5v8, types: [o.gsX] */
@Override // o.gsJ, o.InterfaceC15536gtL
public final gsX with(InterfaceC15537gtP interfaceC15537gtP, long j) {
if (interfaceC15537gtP instanceof EnumC15534gtD) {
EnumC15534gtD enumC15534gtD = (EnumC15534gtD) interfaceC15537gtP;
enumC15534gtD.checkValidValue(j);
int i = (int) j;
switch (AnonymousClass3.$SwitchMap$org$threeten$bp$temporal$ChronoField[enumC15534gtD.ordinal()]) {
case 1:
return resolvePreviousValid(this.yearOfEra, this.monthOfYear, i);
case 2:
int i2 = i - 1;
return resolvePreviousValid(this.yearOfEra, (i2 / 30) + 1, (i2 % 30) + 1);
case 3:
return plusDays((j - getLong(EnumC15534gtD.ALIGNED_WEEK_OF_MONTH)) * 7);
case 4:
if (this.yearOfEra <= 0) {
i = 1 - i;
}
return resolvePreviousValid(i, this.monthOfYear, this.dayOfMonth);
case 5:
return plusDays(j - this.dayOfWeek.getValue());
case 6:
return plusDays(j - getLong(EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_MONTH));
case 7:
return plusDays(j - getLong(EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_YEAR));
case 8:
return new gsX(i);
case 9:
return plusDays((j - getLong(EnumC15534gtD.ALIGNED_WEEK_OF_YEAR)) * 7);
case 10:
return resolvePreviousValid(this.yearOfEra, i, this.dayOfMonth);
case 11:
return resolvePreviousValid(i, this.monthOfYear, this.dayOfMonth);
case 12:
return resolvePreviousValid(1 - this.yearOfEra, this.monthOfYear, this.dayOfMonth);
default:
throw new UnsupportedTemporalTypeException("Unsupported field: ".concat(String.valueOf(interfaceC15537gtP)));
}
}
return (gsX) interfaceC15537gtP.adjustInto(this, j);
}
private static gsX resolvePreviousValid(int i, int i2, int i3) {
int monthDays = getMonthDays(i2 - 1, i);
if (i3 > monthDays) {
i3 = monthDays;
}
return of(i, i2, i3);
}
@Override // o.gsJ, o.AbstractC15535gtF, o.InterfaceC15536gtL
public final gsX plus(gtN gtn) {
return (gsX) super.plus(gtn);
}
@Override // o.gsK, o.gsJ, o.InterfaceC15536gtL
public final gsX plus(long j, InterfaceC15539gtV interfaceC15539gtV) {
return (gsX) super.plus(j, interfaceC15539gtV);
}
@Override // o.gsJ, o.AbstractC15535gtF, o.InterfaceC15536gtL
public final gsX minus(gtN gtn) {
return (gsX) super.minus(gtn);
}
@Override // o.gsJ, o.AbstractC15535gtF, o.InterfaceC15536gtL
public final gsX minus(long j, InterfaceC15539gtV interfaceC15539gtV) {
return (gsX) super.minus(j, interfaceC15539gtV);
}
@Override // o.gsK, o.gsJ
public final gsO<gsX> atTime(C15521gsq c15521gsq) {
return super.atTime(c15521gsq);
}
@Override // o.gsJ
public final long toEpochDay() {
return getGregorianEpochDay(this.yearOfEra, this.monthOfYear, this.dayOfMonth);
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // o.gsK
public final gsK<gsX> plusYears(long j) {
if (j == 0) {
return this;
}
return of(this.era, gtG.safeAdd(this.yearOfEra, (int) j), this.monthOfYear, this.dayOfMonth);
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // o.gsK
public final gsK<gsX> plusMonths(long j) {
if (j == 0) {
return this;
}
int i = (this.monthOfYear - 1) + ((int) j);
int i2 = i / 12;
int i3 = i % 12;
while (i3 < 0) {
i3 += 12;
i2 = gtG.safeSubtract(i2, 1);
}
return of(this.era, gtG.safeAdd(this.yearOfEra, i2), i3 + 1, this.dayOfMonth);
}
/* JADX INFO: Access modifiers changed from: package-private */
@Override // o.gsK
public final gsK<gsX> plusDays(long j) {
return new gsX(this.gregorianEpochDay + j);
}
private static int[] getHijrahDateInfo(long j) {
int i;
int i2;
int monthOfYear;
int dayOfMonth;
int value;
long j2 = 492148 + j;
if (j2 >= 0) {
int cycleNumber = getCycleNumber(j2);
int dayOfCycle = getDayOfCycle(j2, cycleNumber);
int yearInCycle = getYearInCycle(cycleNumber, dayOfCycle);
i2 = getDayOfYear(cycleNumber, dayOfCycle, yearInCycle);
i = (cycleNumber * 30) + yearInCycle + 1;
monthOfYear = getMonthOfYear(i2, i);
dayOfMonth = getDayOfMonth(i2, monthOfYear, i) + 1;
value = EnumC15504gsZ.AH.getValue();
} else {
int i3 = (int) j2;
int i4 = i3 / 10631;
int i5 = i3 % 10631;
if (i5 == 0) {
i4++;
i5 = -10631;
}
int yearInCycle2 = getYearInCycle(i4, i5);
int dayOfYear = getDayOfYear(i4, i5, yearInCycle2);
i = 1 - ((i4 * 30) - yearInCycle2);
i2 = isLeapYear((long) i) ? dayOfYear + 355 : dayOfYear + 354;
monthOfYear = getMonthOfYear(i2, i);
dayOfMonth = getDayOfMonth(i2, monthOfYear, i) + 1;
value = EnumC15504gsZ.BEFORE_AH.getValue();
}
int i6 = (int) ((j + 492153) % 7);
return new int[]{value, i, monthOfYear + 1, dayOfMonth, i2 + 1, i6 + (i6 <= 0 ? 7 : 0)};
}
private static long getGregorianEpochDay(int i, int i2, int i3) {
return yearToGregorianEpochDay(i) + getMonthDays(i2 - 1, i) + i3;
}
private static long yearToGregorianEpochDay(int i) {
Long l;
int i2 = i - 1;
int i3 = i2 / 30;
int i4 = i2 % 30;
int intValue = getAdjustedCycle(i3)[Math.abs(i4)].intValue();
if (i4 < 0) {
intValue = -intValue;
}
try {
l = ADJUSTED_CYCLES[i3];
} catch (ArrayIndexOutOfBoundsException unused) {
l = null;
}
if (l == null) {
l = Long.valueOf(i3 * 10631);
}
return (l.longValue() + intValue) - 492149;
}
private static int getCycleNumber(long j) {
Long[] lArr = ADJUSTED_CYCLES;
for (int i = 0; i < lArr.length; i++) {
try {
if (j < lArr[i].longValue()) {
return i - 1;
}
} catch (ArrayIndexOutOfBoundsException unused) {
return ((int) j) / 10631;
}
}
return ((int) j) / 10631;
}
private static int getDayOfCycle(long j, int i) {
Long l;
try {
l = ADJUSTED_CYCLES[i];
} catch (ArrayIndexOutOfBoundsException unused) {
l = null;
}
if (l == null) {
l = Long.valueOf(i * 10631);
}
return (int) (j - l.longValue());
}
private static int getYearInCycle(int i, long j) {
Integer[] adjustedCycle = getAdjustedCycle(i);
int i2 = 0;
if (j == 0) {
return 0;
}
if (j > 0) {
while (i2 < adjustedCycle.length) {
if (j < adjustedCycle[i2].intValue()) {
return i2 - 1;
}
i2++;
}
return 29;
}
long j2 = -j;
while (i2 < adjustedCycle.length) {
if (j2 <= adjustedCycle[i2].intValue()) {
return i2 - 1;
}
i2++;
}
return 29;
}
private static Integer[] getAdjustedCycle(int i) {
Integer[] numArr;
try {
numArr = ADJUSTED_CYCLE_YEARS.get(Integer.valueOf(i));
} catch (ArrayIndexOutOfBoundsException unused) {
numArr = null;
}
return numArr == null ? DEFAULT_CYCLE_YEARS : numArr;
}
private static Integer[] getAdjustedMonthDays(int i) {
Integer[] numArr;
try {
numArr = ADJUSTED_MONTH_DAYS.get(Integer.valueOf(i));
} catch (ArrayIndexOutOfBoundsException unused) {
numArr = null;
}
return numArr == null ? isLeapYear((long) i) ? DEFAULT_LEAP_MONTH_DAYS : DEFAULT_MONTH_DAYS : numArr;
}
private static Integer[] getAdjustedMonthLength(int i) {
Integer[] numArr;
try {
numArr = ADJUSTED_MONTH_LENGTHS.get(Integer.valueOf(i));
} catch (ArrayIndexOutOfBoundsException unused) {
numArr = null;
}
return numArr == null ? isLeapYear((long) i) ? DEFAULT_LEAP_MONTH_LENGTHS : DEFAULT_MONTH_LENGTHS : numArr;
}
private static int getDayOfYear(int i, int i2, int i3) {
Integer[] adjustedCycle = getAdjustedCycle(i);
if (i2 > 0) {
return i2 - adjustedCycle[i3].intValue();
}
return adjustedCycle[i3].intValue() + i2;
}
private static int getMonthOfYear(int i, int i2) {
Integer[] adjustedMonthDays = getAdjustedMonthDays(i2);
int i3 = 0;
if (i >= 0) {
while (i3 < adjustedMonthDays.length) {
if (i < adjustedMonthDays[i3].intValue()) {
return i3 - 1;
}
i3++;
}
return 11;
}
int i4 = isLeapYear((long) i2) ? i + 355 : i + 354;
while (i3 < adjustedMonthDays.length) {
if (i4 < adjustedMonthDays[i3].intValue()) {
return i3 - 1;
}
i3++;
}
return 11;
}
private static int getDayOfMonth(int i, int i2, int i3) {
int intValue;
Integer[] adjustedMonthDays = getAdjustedMonthDays(i3);
if (i < 0) {
i = isLeapYear((long) i3) ? i + 355 : i + 354;
if (i2 <= 0) {
return i;
}
intValue = adjustedMonthDays[i2].intValue();
} else {
if (i2 <= 0) {
return i;
}
intValue = adjustedMonthDays[i2].intValue();
}
return i - intValue;
}
/* JADX INFO: Access modifiers changed from: package-private */
public static boolean isLeapYear(long j) {
if (j <= 0) {
j = -j;
}
return ((j * 11) + 14) % 30 < 11;
}
private static int getMonthDays(int i, int i2) {
return getAdjustedMonthDays(i2)[i].intValue();
}
static int getMonthLength(int i, int i2) {
return getAdjustedMonthLength(i2)[i].intValue();
}
@Override // o.gsJ
public final int lengthOfMonth() {
return getMonthLength(this.monthOfYear - 1, this.yearOfEra);
}
static int getYearLength(int i) {
Integer[] numArr;
int i2 = i - 1;
int i3 = i2 / 30;
try {
numArr = ADJUSTED_CYCLE_YEARS.get(Integer.valueOf(i3));
} catch (ArrayIndexOutOfBoundsException unused) {
numArr = null;
}
if (numArr == null) {
return isLeapYear((long) i) ? 355 : 354;
}
int i4 = i2 % 30;
if (i4 == 29) {
Long[] lArr = ADJUSTED_CYCLES;
return (lArr[i3 + 1].intValue() - lArr[i3].intValue()) - numArr[i4].intValue();
}
return numArr[i4 + 1].intValue() - numArr[i4].intValue();
}
@Override // o.gsJ
public final int lengthOfYear() {
return getYearLength(this.yearOfEra);
}
static int getMaximumDayOfMonth() {
return ADJUSTED_MAX_VALUES[5].intValue();
}
static int getSmallestMaximumDayOfMonth() {
return ADJUSTED_LEAST_MAX_VALUES[5].intValue();
}
static int getMaximumDayOfYear() {
return ADJUSTED_MAX_VALUES[6].intValue();
}
static int getSmallestMaximumDayOfYear() {
return ADJUSTED_LEAST_MAX_VALUES[6].intValue();
}
private static void addDeviationAsHijrah(int i, int i2, int i3, int i4, int i5) {
if (i <= 0) {
throw new IllegalArgumentException("startYear < 1");
}
if (i3 <= 0) {
throw new IllegalArgumentException("endYear < 1");
}
if (i2 < 0 || i2 > 11) {
throw new IllegalArgumentException("startMonth < 0 || startMonth > 11");
}
if (i4 < 0 || i4 > 11) {
throw new IllegalArgumentException("endMonth < 0 || endMonth > 11");
}
if (i3 > 9999) {
throw new IllegalArgumentException("endYear > 9999");
}
if (i3 < i) {
throw new IllegalArgumentException("startYear > endYear");
}
if (i3 == i && i4 < i2) {
throw new IllegalArgumentException("startYear == endYear && endMonth < startMonth");
}
boolean isLeapYear = isLeapYear(i);
Integer[] numArr = ADJUSTED_MONTH_DAYS.get(Integer.valueOf(i));
if (numArr == null) {
if (isLeapYear) {
numArr = new Integer[LEAP_NUM_DAYS.length];
int i6 = 0;
while (true) {
int[] iArr = LEAP_NUM_DAYS;
if (i6 >= iArr.length) {
break;
}
numArr[i6] = Integer.valueOf(iArr[i6]);
i6++;
}
} else {
numArr = new Integer[NUM_DAYS.length];
int i7 = 0;
while (true) {
int[] iArr2 = NUM_DAYS;
if (i7 >= iArr2.length) {
break;
}
numArr[i7] = Integer.valueOf(iArr2[i7]);
i7++;
}
}
}
Integer[] numArr2 = new Integer[numArr.length];
for (int i8 = 0; i8 < 12; i8++) {
if (i8 > i2) {
numArr2[i8] = Integer.valueOf(numArr[i8].intValue() - i5);
} else {
numArr2[i8] = Integer.valueOf(numArr[i8].intValue());
}
}
ADJUSTED_MONTH_DAYS.put(Integer.valueOf(i), numArr2);
Integer[] numArr3 = ADJUSTED_MONTH_LENGTHS.get(Integer.valueOf(i));
if (numArr3 == null) {
if (isLeapYear) {
numArr3 = new Integer[LEAP_MONTH_LENGTH.length];
int i9 = 0;
while (true) {
int[] iArr3 = LEAP_MONTH_LENGTH;
if (i9 >= iArr3.length) {
break;
}
numArr3[i9] = Integer.valueOf(iArr3[i9]);
i9++;
}
} else {
numArr3 = new Integer[MONTH_LENGTH.length];
int i10 = 0;
while (true) {
int[] iArr4 = MONTH_LENGTH;
if (i10 >= iArr4.length) {
break;
}
numArr3[i10] = Integer.valueOf(iArr4[i10]);
i10++;
}
}
}
Integer[] numArr4 = new Integer[numArr3.length];
for (int i11 = 0; i11 < 12; i11++) {
if (i11 == i2) {
numArr4[i11] = Integer.valueOf(numArr3[i11].intValue() - i5);
} else {
numArr4[i11] = Integer.valueOf(numArr3[i11].intValue());
}
}
ADJUSTED_MONTH_LENGTHS.put(Integer.valueOf(i), numArr4);
if (i != i3) {
int i12 = i - 1;
int i13 = i12 / 30;
Integer[] numArr5 = ADJUSTED_CYCLE_YEARS.get(Integer.valueOf(i13));
if (numArr5 == null) {
int length = CYCLEYEAR_START_DATE.length;
Integer[] numArr6 = new Integer[length];
for (int i14 = 0; i14 < length; i14++) {
numArr6[i14] = Integer.valueOf(CYCLEYEAR_START_DATE[i14]);
}
numArr5 = numArr6;
}
int i15 = i12 % 30;
while (true) {
i15++;
if (i15 >= CYCLEYEAR_START_DATE.length) {
break;
} else {
numArr5[i15] = Integer.valueOf(numArr5[i15].intValue() - i5);
}
}
ADJUSTED_CYCLE_YEARS.put(Integer.valueOf(i13), numArr5);
int i16 = i3 - 1;
int i17 = i16 / 30;
if (i13 != i17) {
while (true) {
i13++;
Long[] lArr = ADJUSTED_CYCLES;
if (i13 >= lArr.length) {
break;
} else {
lArr[i13] = Long.valueOf(lArr[i13].longValue() - i5);
}
}
int i18 = i17 + 1;
while (true) {
Long[] lArr2 = ADJUSTED_CYCLES;
if (i18 >= lArr2.length) {
break;
}
lArr2[i18] = Long.valueOf(lArr2[i18].longValue() + i5);
i18++;
}
}
Integer[] numArr7 = ADJUSTED_CYCLE_YEARS.get(Integer.valueOf(i17));
if (numArr7 == null) {
int length2 = CYCLEYEAR_START_DATE.length;
Integer[] numArr8 = new Integer[length2];
for (int i19 = 0; i19 < length2; i19++) {
numArr8[i19] = Integer.valueOf(CYCLEYEAR_START_DATE[i19]);
}
numArr7 = numArr8;
}
int i20 = i16 % 30;
while (true) {
i20++;
if (i20 >= CYCLEYEAR_START_DATE.length) {
break;
} else {
numArr7[i20] = Integer.valueOf(numArr7[i20].intValue() + i5);
}
}
ADJUSTED_CYCLE_YEARS.put(Integer.valueOf(i17), numArr7);
}
boolean isLeapYear2 = isLeapYear(i3);
Integer[] numArr9 = ADJUSTED_MONTH_DAYS.get(Integer.valueOf(i3));
if (numArr9 == null) {
if (isLeapYear2) {
numArr9 = new Integer[LEAP_NUM_DAYS.length];
int i21 = 0;
while (true) {
int[] iArr5 = LEAP_NUM_DAYS;
if (i21 >= iArr5.length) {
break;
}
numArr9[i21] = Integer.valueOf(iArr5[i21]);
i21++;
}
} else {
numArr9 = new Integer[NUM_DAYS.length];
int i22 = 0;
while (true) {
int[] iArr6 = NUM_DAYS;
if (i22 >= iArr6.length) {
break;
}
numArr9[i22] = Integer.valueOf(iArr6[i22]);
i22++;
}
}
}
Integer[] numArr10 = new Integer[numArr9.length];
for (int i23 = 0; i23 < 12; i23++) {
if (i23 > i4) {
numArr10[i23] = Integer.valueOf(numArr9[i23].intValue() + i5);
} else {
numArr10[i23] = Integer.valueOf(numArr9[i23].intValue());
}
}
ADJUSTED_MONTH_DAYS.put(Integer.valueOf(i3), numArr10);
Integer[] numArr11 = ADJUSTED_MONTH_LENGTHS.get(Integer.valueOf(i3));
if (numArr11 == null) {
if (isLeapYear2) {
numArr11 = new Integer[LEAP_MONTH_LENGTH.length];
int i24 = 0;
while (true) {
int[] iArr7 = LEAP_MONTH_LENGTH;
if (i24 >= iArr7.length) {
break;
}
numArr11[i24] = Integer.valueOf(iArr7[i24]);
i24++;
}
} else {
numArr11 = new Integer[MONTH_LENGTH.length];
int i25 = 0;
while (true) {
int[] iArr8 = MONTH_LENGTH;
if (i25 >= iArr8.length) {
break;
}
numArr11[i25] = Integer.valueOf(iArr8[i25]);
i25++;
}
}
}
Integer[] numArr12 = new Integer[numArr11.length];
for (int i26 = 0; i26 < 12; i26++) {
if (i26 == i4) {
numArr12[i26] = Integer.valueOf(numArr11[i26].intValue() + i5);
} else {
numArr12[i26] = Integer.valueOf(numArr11[i26].intValue());
}
}
HashMap<Integer, Integer[]> hashMap = ADJUSTED_MONTH_LENGTHS;
hashMap.put(Integer.valueOf(i3), numArr12);
Integer[] numArr13 = hashMap.get(Integer.valueOf(i));
Integer[] numArr14 = hashMap.get(Integer.valueOf(i3));
HashMap<Integer, Integer[]> hashMap2 = ADJUSTED_MONTH_DAYS;
Integer[] numArr15 = hashMap2.get(Integer.valueOf(i));
Integer[] numArr16 = hashMap2.get(Integer.valueOf(i3));
int intValue = numArr13[i2].intValue();
int intValue2 = numArr14[i4].intValue();
int intValue3 = numArr15[11].intValue() + numArr13[11].intValue();
int intValue4 = numArr16[11].intValue() + numArr14[11].intValue();
Integer[] numArr17 = ADJUSTED_MAX_VALUES;
int intValue5 = numArr17[5].intValue();
Integer[] numArr18 = ADJUSTED_LEAST_MAX_VALUES;
int intValue6 = numArr18[5].intValue();
if (intValue5 < intValue) {
intValue5 = intValue;
}
if (intValue5 < intValue2) {
intValue5 = intValue2;
}
numArr17[5] = Integer.valueOf(intValue5);
if (intValue6 <= intValue) {
intValue = intValue6;
}
if (intValue <= intValue2) {
intValue2 = intValue;
}
numArr18[5] = Integer.valueOf(intValue2);
int intValue7 = numArr17[6].intValue();
int intValue8 = numArr18[6].intValue();
if (intValue7 < intValue3) {
intValue7 = intValue3;
}
if (intValue7 < intValue4) {
intValue7 = intValue4;
}
numArr17[6] = Integer.valueOf(intValue7);
if (intValue8 <= intValue3) {
intValue3 = intValue8;
}
if (intValue3 <= intValue4) {
intValue4 = intValue3;
}
numArr18[6] = Integer.valueOf(intValue4);
}
private static void readDeviationConfig() throws IOException, ParseException {
BufferedReader bufferedReader;
InputStream configFileInputStream = getConfigFileInputStream();
if (configFileInputStream == null) {
return;
}
try {
bufferedReader = new BufferedReader(new InputStreamReader(configFileInputStream));
int i = 0;
while (true) {
try {
String readLine = bufferedReader.readLine();
if (readLine != null) {
i++;
parseLine(readLine.trim(), i);
} else {
bufferedReader.close();
return;
}
} catch (Throwable th) {
th = th;
if (bufferedReader != null) {
bufferedReader.close();
}
throw th;
}
}
} catch (Throwable th2) {
th = th2;
bufferedReader = null;
}
}
private static void parseLine(String str, int i) throws ParseException {
StringTokenizer stringTokenizer = new StringTokenizer(str, ";");
while (stringTokenizer.hasMoreTokens()) {
String nextToken = stringTokenizer.nextToken();
int indexOf = nextToken.indexOf(58);
if (indexOf != -1) {
try {
int parseInt = Integer.parseInt(nextToken.substring(indexOf + 1, nextToken.length()));
int indexOf2 = nextToken.indexOf(45);
if (indexOf2 != -1) {
String substring = nextToken.substring(0, indexOf2);
String substring2 = nextToken.substring(indexOf2 + 1, indexOf);
int indexOf3 = substring.indexOf(47);
int indexOf4 = substring2.indexOf(47);
if (indexOf3 != -1) {
String substring3 = substring.substring(0, indexOf3);
String substring4 = substring.substring(indexOf3 + 1, substring.length());
try {
int parseInt2 = Integer.parseInt(substring3);
try {
int parseInt3 = Integer.parseInt(substring4);
if (indexOf4 != -1) {
String substring5 = substring2.substring(0, indexOf4);
String substring6 = substring2.substring(indexOf4 + 1, substring2.length());
try {
int parseInt4 = Integer.parseInt(substring5);
try {
int parseInt5 = Integer.parseInt(substring6);
if (parseInt2 != -1 && parseInt3 != -1 && parseInt4 != -1 && parseInt5 != -1) {
addDeviationAsHijrah(parseInt2, parseInt3, parseInt4, parseInt5, parseInt);
} else {
StringBuilder sb = new StringBuilder("Unknown error at line ");
sb.append(i);
sb.append(".");
throw new ParseException(sb.toString(), i);
}
} catch (NumberFormatException unused) {
StringBuilder sb2 = new StringBuilder("End month is not properly set at line ");
sb2.append(i);
sb2.append(".");
throw new ParseException(sb2.toString(), i);
}
} catch (NumberFormatException unused2) {
StringBuilder sb3 = new StringBuilder("End year is not properly set at line ");
sb3.append(i);
sb3.append(".");
throw new ParseException(sb3.toString(), i);
}
} else {
StringBuilder sb4 = new StringBuilder("End year/month has incorrect format at line ");
sb4.append(i);
sb4.append(".");
throw new ParseException(sb4.toString(), i);
}
} catch (NumberFormatException unused3) {
StringBuilder sb5 = new StringBuilder("Start month is not properly set at line ");
sb5.append(i);
sb5.append(".");
throw new ParseException(sb5.toString(), i);
}
} catch (NumberFormatException unused4) {
StringBuilder sb6 = new StringBuilder("Start year is not properly set at line ");
sb6.append(i);
sb6.append(".");
throw new ParseException(sb6.toString(), i);
}
} else {
StringBuilder sb7 = new StringBuilder("Start year/month has incorrect format at line ");
sb7.append(i);
sb7.append(".");
throw new ParseException(sb7.toString(), i);
}
} else {
StringBuilder sb8 = new StringBuilder("Start and end year/month has incorrect format at line ");
sb8.append(i);
sb8.append(".");
throw new ParseException(sb8.toString(), i);
}
} catch (NumberFormatException unused5) {
StringBuilder sb9 = new StringBuilder("Offset is not properly set at line ");
sb9.append(i);
sb9.append(".");
throw new ParseException(sb9.toString(), i);
}
} else {
StringBuilder sb10 = new StringBuilder("Offset has incorrect format at line ");
sb10.append(i);
sb10.append(".");
throw new ParseException(sb10.toString(), i);
}
}
}
private static InputStream getConfigFileInputStream() throws IOException {
ZipFile zipFile;
String property = System.getProperty("org.threeten.bp.i18n.HijrahDate.deviationConfigFile");
if (property == null) {
property = DEFAULT_CONFIG_FILENAME;
}
String property2 = System.getProperty("org.threeten.bp.i18n.HijrahDate.deviationConfigDir");
if (property2 != null) {
if (property2.length() != 0 || !property2.endsWith(System.getProperty("file.separator"))) {
StringBuilder sb = new StringBuilder();
sb.append(property2);
sb.append(System.getProperty("file.separator"));
property2 = sb.toString();
}
StringBuilder sb2 = new StringBuilder();
sb2.append(property2);
sb2.append(FILE_SEP);
sb2.append(property);
File file = new File(sb2.toString());
if (file.exists()) {
return new FileInputStream(file);
}
return null;
}
StringTokenizer stringTokenizer = new StringTokenizer(System.getProperty("java.class.path"), PATH_SEP);
while (stringTokenizer.hasMoreTokens()) {
String nextToken = stringTokenizer.nextToken();
File file2 = new File(nextToken);
if (file2.exists()) {
if (file2.isDirectory()) {
StringBuilder sb3 = new StringBuilder();
sb3.append(nextToken);
char c = FILE_SEP;
sb3.append(c);
String str = DEFAULT_CONFIG_PATH;
sb3.append(str);
if (new File(sb3.toString(), property).exists()) {
StringBuilder sb4 = new StringBuilder();
sb4.append(nextToken);
sb4.append(c);
sb4.append(str);
sb4.append(c);
sb4.append(property);
return new FileInputStream(sb4.toString());
}
} else {
try {
zipFile = new ZipFile(file2);
} catch (IOException unused) {
zipFile = null;
}
if (zipFile != null) {
StringBuilder sb5 = new StringBuilder();
sb5.append(DEFAULT_CONFIG_PATH);
char c2 = FILE_SEP;
sb5.append(c2);
sb5.append(property);
String obj = sb5.toString();
ZipEntry entry = zipFile.getEntry(obj);
if (entry == null) {
if (c2 == '/') {
obj = obj.replace('/', '\\');
} else if (c2 == '\\') {
obj = obj.replace('\\', '/');
}
entry = zipFile.getEntry(obj);
}
if (entry != null) {
return zipFile.getInputStream(entry);
}
} else {
continue;
}
}
}
}
return null;
}
private Object writeReplace() {
return new C15548gti((byte) 3, this);
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void writeExternal(DataOutput dataOutput) throws IOException {
dataOutput.writeInt(get(EnumC15534gtD.YEAR));
dataOutput.writeByte(get(EnumC15534gtD.MONTH_OF_YEAR));
dataOutput.writeByte(get(EnumC15534gtD.DAY_OF_MONTH));
}
/* JADX INFO: Access modifiers changed from: package-private */
public static gsJ readExternal(DataInput dataInput) throws IOException {
return C15540gta.INSTANCE.date(dataInput.readInt(), (int) dataInput.readByte(), (int) dataInput.readByte());
}
@Override // o.gsJ
public final boolean isLeapYear() {
return this.isLeapYear;
}
@Override // o.gsJ
public final EnumC15504gsZ getEra() {
return this.era;
}
}