package o; import java.io.Serializable; import java.util.Arrays; import java.util.List; import java.util.Map; import org.threeten.bp.DateTimeException; /* renamed from: o.gtj, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C15549gtj extends gsR implements Serializable { public static final C15549gtj INSTANCE = new C15549gtj(); static final int YEARS_DIFFERENCE = 543; private static final long serialVersionUID = 2775954514031616474L; @Override // o.gsR public final /* bridge */ /* synthetic */ gsJ resolveDate(Map map, gtA gta) { return resolveDate((Map) map, gta); } private C15549gtj() { } @Override // o.gsR public final C15550gtk date(gsY gsy, int i, int i2, int i3) { return (C15550gtk) super.date(gsy, i, i2, i3); } @Override // o.gsR public final C15550gtk date(int i, int i2, int i3) { return new C15550gtk(C15520gsp.of(i - 543, i2, i3)); } @Override // o.gsR public final C15550gtk dateYearDay(gsY gsy, int i, int i2) { return (C15550gtk) super.dateYearDay(gsy, i, i2); } @Override // o.gsR public final C15550gtk dateYearDay(int i, int i2) { return new C15550gtk(C15520gsp.ofYearDay(i - 543, i2)); } @Override // o.gsR public final C15550gtk dateEpochDay(long j) { return new C15550gtk(C15520gsp.ofEpochDay(j)); } @Override // o.gsR public final C15550gtk date(gtK gtk) { if (gtk instanceof C15550gtk) { return (C15550gtk) gtk; } return new C15550gtk(C15520gsp.from(gtk)); } @Override // o.gsR public final gsO localDateTime(gtK gtk) { return super.localDateTime(gtk); } @Override // o.gsR public final gsS zonedDateTime(gtK gtk) { return super.zonedDateTime(gtk); } @Override // o.gsR public final gsS zonedDateTime(C15523gss c15523gss, AbstractC15502gsH abstractC15502gsH) { return super.zonedDateTime(c15523gss, abstractC15502gsH); } @Override // o.gsR public final C15550gtk dateNow() { return (C15550gtk) super.dateNow(); } @Override // o.gsR public final C15550gtk dateNow(AbstractC15502gsH abstractC15502gsH) { return (C15550gtk) super.dateNow(abstractC15502gsH); } @Override // o.gsR public final C15550gtk dateNow(AbstractC15514gsj abstractC15514gsj) { gtG.requireNonNull(abstractC15514gsj, "clock"); return (C15550gtk) super.dateNow(abstractC15514gsj); } @Override // o.gsR public final boolean isLeapYear(long j) { return gsV.INSTANCE.isLeapYear(j - 543); } @Override // o.gsR public final int prolepticYear(gsY gsy, int i) { if (gsy instanceof EnumC15555gtp) { return gsy != EnumC15555gtp.BE ? 1 - i : i; } throw new ClassCastException("Era must be BuddhistEra"); } @Override // o.gsR public final EnumC15555gtp eraOf(int i) { return EnumC15555gtp.of(i); } @Override // o.gsR public final List eras() { return Arrays.asList(EnumC15555gtp.values()); } /* renamed from: o.gtj$5, reason: invalid class name */ /* loaded from: classes6.dex */ static /* synthetic */ class AnonymousClass5 { 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.PROLEPTIC_MONTH.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.YEAR_OF_ERA.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { $SwitchMap$org$threeten$bp$temporal$ChronoField[EnumC15534gtD.YEAR.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } } } @Override // o.gsR public final gtT range(EnumC15534gtD enumC15534gtD) { int i = AnonymousClass5.$SwitchMap$org$threeten$bp$temporal$ChronoField[enumC15534gtD.ordinal()]; if (i == 1) { gtT range = EnumC15534gtD.PROLEPTIC_MONTH.range(); return gtT.of(range.getMinimum() + 6516, range.getMaximum() + 6516); } if (i == 2) { gtT range2 = EnumC15534gtD.YEAR.range(); return gtT.of(1L, 1 - (range2.getMinimum() + 543), range2.getMaximum() + 543); } if (i == 3) { gtT range3 = EnumC15534gtD.YEAR.range(); return gtT.of(range3.getMinimum() + 543, range3.getMaximum() + 543); } return enumC15534gtD.range(); } /* JADX WARN: Type inference failed for: r11v20, types: [o.gtE, o.gtk] */ /* JADX WARN: Type inference failed for: r11v35, types: [o.gtk] */ /* JADX WARN: Type inference failed for: r11v71, types: [o.gtk] */ @Override // o.gsR public final C15550gtk resolveDate(Map map, gtA gta) { if (map.containsKey(EnumC15534gtD.EPOCH_DAY)) { return dateEpochDay(map.remove(EnumC15534gtD.EPOCH_DAY).longValue()); } Long remove = map.remove(EnumC15534gtD.PROLEPTIC_MONTH); if (remove != null) { if (gta != gtA.LENIENT) { EnumC15534gtD.PROLEPTIC_MONTH.checkValidValue(remove.longValue()); } updateResolveMap(map, EnumC15534gtD.MONTH_OF_YEAR, gtG.floorMod(remove.longValue(), 12) + 1); updateResolveMap(map, EnumC15534gtD.YEAR, gtG.floorDiv(remove.longValue(), 12L)); } Long remove2 = map.remove(EnumC15534gtD.YEAR_OF_ERA); if (remove2 != null) { if (gta != gtA.LENIENT) { EnumC15534gtD.YEAR_OF_ERA.checkValidValue(remove2.longValue()); } Long remove3 = map.remove(EnumC15534gtD.ERA); if (remove3 == null) { Long l = map.get(EnumC15534gtD.YEAR); if (gta != gtA.STRICT) { updateResolveMap(map, EnumC15534gtD.YEAR, (l == null || l.longValue() > 0) ? remove2.longValue() : gtG.safeSubtract(1L, remove2.longValue())); } else if (l != null) { updateResolveMap(map, EnumC15534gtD.YEAR, l.longValue() > 0 ? remove2.longValue() : gtG.safeSubtract(1L, remove2.longValue())); } else { map.put(EnumC15534gtD.YEAR_OF_ERA, remove2); } } else if (remove3.longValue() == 1) { updateResolveMap(map, EnumC15534gtD.YEAR, remove2.longValue()); } else if (remove3.longValue() == 0) { updateResolveMap(map, EnumC15534gtD.YEAR, gtG.safeSubtract(1L, remove2.longValue())); } else { throw new DateTimeException("Invalid value for era: ".concat(String.valueOf(remove3))); } } else if (map.containsKey(EnumC15534gtD.ERA)) { EnumC15534gtD.ERA.checkValidValue(map.get(EnumC15534gtD.ERA).longValue()); } if (!map.containsKey(EnumC15534gtD.YEAR)) { return null; } if (map.containsKey(EnumC15534gtD.MONTH_OF_YEAR)) { if (map.containsKey(EnumC15534gtD.DAY_OF_MONTH)) { int checkValidIntValue = EnumC15534gtD.YEAR.checkValidIntValue(map.remove(EnumC15534gtD.YEAR).longValue()); if (gta == gtA.LENIENT) { return date(checkValidIntValue, 1, 1).plusMonths(gtG.safeSubtract(map.remove(EnumC15534gtD.MONTH_OF_YEAR).longValue(), 1L)).plusDays(gtG.safeSubtract(map.remove(EnumC15534gtD.DAY_OF_MONTH).longValue(), 1L)); } int checkValidIntValue2 = range(EnumC15534gtD.MONTH_OF_YEAR).checkValidIntValue(map.remove(EnumC15534gtD.MONTH_OF_YEAR).longValue(), EnumC15534gtD.MONTH_OF_YEAR); int checkValidIntValue3 = range(EnumC15534gtD.DAY_OF_MONTH).checkValidIntValue(map.remove(EnumC15534gtD.DAY_OF_MONTH).longValue(), EnumC15534gtD.DAY_OF_MONTH); if (gta == gtA.SMART && checkValidIntValue3 > 28) { checkValidIntValue3 = Math.min(checkValidIntValue3, date(checkValidIntValue, checkValidIntValue2, 1).lengthOfMonth()); } return date(checkValidIntValue, checkValidIntValue2, checkValidIntValue3); } if (map.containsKey(EnumC15534gtD.ALIGNED_WEEK_OF_MONTH)) { if (map.containsKey(EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_MONTH)) { int checkValidIntValue4 = EnumC15534gtD.YEAR.checkValidIntValue(map.remove(EnumC15534gtD.YEAR).longValue()); if (gta == gtA.LENIENT) { return date(checkValidIntValue4, 1, 1).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.MONTH_OF_YEAR).longValue(), 1L), (InterfaceC15539gtV) gtH.MONTHS).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.ALIGNED_WEEK_OF_MONTH).longValue(), 1L), (InterfaceC15539gtV) gtH.WEEKS).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_MONTH).longValue(), 1L), (InterfaceC15539gtV) gtH.DAYS); } int checkValidIntValue5 = EnumC15534gtD.MONTH_OF_YEAR.checkValidIntValue(map.remove(EnumC15534gtD.MONTH_OF_YEAR).longValue()); C15550gtk plus = date(checkValidIntValue4, checkValidIntValue5, 1).plus(((EnumC15534gtD.ALIGNED_WEEK_OF_MONTH.checkValidIntValue(map.remove(EnumC15534gtD.ALIGNED_WEEK_OF_MONTH).longValue()) - 1) * 7) + (EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_MONTH.checkValidIntValue(map.remove(EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_MONTH).longValue()) - 1), (InterfaceC15539gtV) gtH.DAYS); if (gta != gtA.STRICT || plus.get(EnumC15534gtD.MONTH_OF_YEAR) == checkValidIntValue5) { return plus; } throw new DateTimeException("Strict mode rejected date parsed to a different month"); } if (map.containsKey(EnumC15534gtD.DAY_OF_WEEK)) { int checkValidIntValue6 = EnumC15534gtD.YEAR.checkValidIntValue(map.remove(EnumC15534gtD.YEAR).longValue()); if (gta == gtA.LENIENT) { return date(checkValidIntValue6, 1, 1).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.MONTH_OF_YEAR).longValue(), 1L), (InterfaceC15539gtV) gtH.MONTHS).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.ALIGNED_WEEK_OF_MONTH).longValue(), 1L), (InterfaceC15539gtV) gtH.WEEKS).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.DAY_OF_WEEK).longValue(), 1L), (InterfaceC15539gtV) gtH.DAYS); } int checkValidIntValue7 = EnumC15534gtD.MONTH_OF_YEAR.checkValidIntValue(map.remove(EnumC15534gtD.MONTH_OF_YEAR).longValue()); C15550gtk with = date(checkValidIntValue6, checkValidIntValue7, 1).plus(EnumC15534gtD.ALIGNED_WEEK_OF_MONTH.checkValidIntValue(map.remove(EnumC15534gtD.ALIGNED_WEEK_OF_MONTH).longValue()) - 1, (InterfaceC15539gtV) gtH.WEEKS).with(gtO.nextOrSame(EnumC15515gsk.of(EnumC15534gtD.DAY_OF_WEEK.checkValidIntValue(map.remove(EnumC15534gtD.DAY_OF_WEEK).longValue())))); if (gta != gtA.STRICT || with.get(EnumC15534gtD.MONTH_OF_YEAR) == checkValidIntValue7) { return with; } throw new DateTimeException("Strict mode rejected date parsed to a different month"); } } } if (map.containsKey(EnumC15534gtD.DAY_OF_YEAR)) { int checkValidIntValue8 = EnumC15534gtD.YEAR.checkValidIntValue(map.remove(EnumC15534gtD.YEAR).longValue()); if (gta == gtA.LENIENT) { return dateYearDay(checkValidIntValue8, 1).plusDays(gtG.safeSubtract(map.remove(EnumC15534gtD.DAY_OF_YEAR).longValue(), 1L)); } return dateYearDay(checkValidIntValue8, EnumC15534gtD.DAY_OF_YEAR.checkValidIntValue(map.remove(EnumC15534gtD.DAY_OF_YEAR).longValue())); } if (!map.containsKey(EnumC15534gtD.ALIGNED_WEEK_OF_YEAR)) { return null; } if (map.containsKey(EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_YEAR)) { int checkValidIntValue9 = EnumC15534gtD.YEAR.checkValidIntValue(map.remove(EnumC15534gtD.YEAR).longValue()); if (gta == gtA.LENIENT) { return date(checkValidIntValue9, 1, 1).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.ALIGNED_WEEK_OF_YEAR).longValue(), 1L), (InterfaceC15539gtV) gtH.WEEKS).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_YEAR).longValue(), 1L), (InterfaceC15539gtV) gtH.DAYS); } ?? plusDays = date(checkValidIntValue9, 1, 1).plusDays(((EnumC15534gtD.ALIGNED_WEEK_OF_YEAR.checkValidIntValue(map.remove(EnumC15534gtD.ALIGNED_WEEK_OF_YEAR).longValue()) - 1) * 7) + (EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_YEAR.checkValidIntValue(map.remove(EnumC15534gtD.ALIGNED_DAY_OF_WEEK_IN_YEAR).longValue()) - 1)); if (gta != gtA.STRICT || plusDays.get(EnumC15534gtD.YEAR) == checkValidIntValue9) { return plusDays; } throw new DateTimeException("Strict mode rejected date parsed to a different year"); } if (!map.containsKey(EnumC15534gtD.DAY_OF_WEEK)) { return null; } int checkValidIntValue10 = EnumC15534gtD.YEAR.checkValidIntValue(map.remove(EnumC15534gtD.YEAR).longValue()); if (gta == gtA.LENIENT) { return date(checkValidIntValue10, 1, 1).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.ALIGNED_WEEK_OF_YEAR).longValue(), 1L), (InterfaceC15539gtV) gtH.WEEKS).plus(gtG.safeSubtract(map.remove(EnumC15534gtD.DAY_OF_WEEK).longValue(), 1L), (InterfaceC15539gtV) gtH.DAYS); } C15550gtk with2 = date(checkValidIntValue10, 1, 1).plus(EnumC15534gtD.ALIGNED_WEEK_OF_YEAR.checkValidIntValue(map.remove(EnumC15534gtD.ALIGNED_WEEK_OF_YEAR).longValue()) - 1, (InterfaceC15539gtV) gtH.WEEKS).with(gtO.nextOrSame(EnumC15515gsk.of(EnumC15534gtD.DAY_OF_WEEK.checkValidIntValue(map.remove(EnumC15534gtD.DAY_OF_WEEK).longValue())))); if (gta != gtA.STRICT || with2.get(EnumC15534gtD.YEAR) == checkValidIntValue10) { return with2; } throw new DateTimeException("Strict mode rejected date parsed to a different month"); } @Override // o.gsR public final String getId() { return "ThaiBuddhist"; } @Override // o.gsR public final String getCalendarType() { return "buddhist"; } private Object readResolve() { return INSTANCE; } }