package j$.time.format;

import j$.time.DateTimeException;
import j$.time.LocalDate;
import j$.time.ZoneId;
import j$.time.ZoneOffset;
import j$.time.chrono.ChronoLocalDate;
import j$.time.chrono.ChronoLocalDateTime;
import j$.time.chrono.ChronoZonedDateTime;
import j$.time.temporal.TemporalAccessor;
import j$.util.Objects;
import java.io.IOException;
import java.text.ParsePosition;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;

/* JADX INFO: compiled from: r8-map-id-da1bda724d8b26dc30f90d2ccf434f42461d6c82e7dbdeb074f412e5504de99c */
/* JADX INFO: loaded from: classes2.dex */
public final class DateTimeFormatter {
    public static final DateTimeFormatter ISO_LOCAL_DATE;
    public static final DateTimeFormatter RFC_1123_DATE_TIME;
    public static final DateTimeFormatter f;
    public final d a;
    public final Locale b;
    public final b0 c;
    public final d0 d;
    public final j$.time.chrono.j e;

    static {
        u uVar = new u();
        j$.time.temporal.a aVar = j$.time.temporal.a.YEAR;
        e0 e0Var = e0.EXCEEDS_PAD;
        uVar.m(aVar, 4, 10, e0Var);
        uVar.d('-');
        j$.time.temporal.a aVar2 = j$.time.temporal.a.MONTH_OF_YEAR;
        uVar.l(aVar2, 2);
        uVar.d('-');
        j$.time.temporal.a aVar3 = j$.time.temporal.a.DAY_OF_MONTH;
        uVar.l(aVar3, 2);
        d0 d0Var = d0.STRICT;
        j$.time.chrono.q qVar = j$.time.chrono.q.c;
        DateTimeFormatter dateTimeFormatterP = uVar.p(d0Var, qVar);
        ISO_LOCAL_DATE = dateTimeFormatterP;
        u uVar2 = new u();
        p pVar = p.INSENSITIVE;
        uVar2.c(pVar);
        uVar2.a(dateTimeFormatterP);
        j jVar = j.e;
        uVar2.c(jVar);
        uVar2.p(d0Var, qVar);
        u uVar3 = new u();
        uVar3.c(pVar);
        uVar3.a(dateTimeFormatterP);
        uVar3.o();
        uVar3.c(jVar);
        uVar3.p(d0Var, qVar);
        u uVar4 = new u();
        j$.time.temporal.a aVar4 = j$.time.temporal.a.HOUR_OF_DAY;
        uVar4.l(aVar4, 2);
        uVar4.d(':');
        j$.time.temporal.a aVar5 = j$.time.temporal.a.MINUTE_OF_HOUR;
        uVar4.l(aVar5, 2);
        uVar4.o();
        uVar4.d(':');
        j$.time.temporal.a aVar6 = j$.time.temporal.a.SECOND_OF_MINUTE;
        uVar4.l(aVar6, 2);
        uVar4.o();
        uVar4.b(j$.time.temporal.a.NANO_OF_SECOND, 0, 9, true);
        DateTimeFormatter dateTimeFormatterP2 = uVar4.p(d0Var, null);
        u uVar5 = new u();
        uVar5.c(pVar);
        uVar5.a(dateTimeFormatterP2);
        uVar5.c(jVar);
        uVar5.p(d0Var, null);
        u uVar6 = new u();
        uVar6.c(pVar);
        uVar6.a(dateTimeFormatterP2);
        uVar6.o();
        uVar6.c(jVar);
        uVar6.p(d0Var, null);
        u uVar7 = new u();
        uVar7.c(pVar);
        uVar7.a(dateTimeFormatterP);
        uVar7.d('T');
        uVar7.a(dateTimeFormatterP2);
        DateTimeFormatter dateTimeFormatterP3 = uVar7.p(d0Var, qVar);
        u uVar8 = new u();
        uVar8.c(pVar);
        uVar8.a(dateTimeFormatterP3);
        p pVar2 = p.LENIENT;
        uVar8.c(pVar2);
        uVar8.c(jVar);
        p pVar3 = p.STRICT;
        uVar8.c(pVar3);
        DateTimeFormatter dateTimeFormatterP4 = uVar8.p(d0Var, qVar);
        u uVar9 = new u();
        uVar9.a(dateTimeFormatterP4);
        uVar9.o();
        uVar9.d('[');
        p pVar4 = p.SENSITIVE;
        uVar9.c(pVar4);
        j$.time.f fVar = u.h;
        uVar9.c(new s(fVar, "ZoneRegionId()"));
        uVar9.d(']');
        uVar9.p(d0Var, qVar);
        u uVar10 = new u();
        uVar10.a(dateTimeFormatterP3);
        uVar10.o();
        uVar10.c(jVar);
        uVar10.o();
        uVar10.d('[');
        uVar10.c(pVar4);
        uVar10.c(new s(fVar, "ZoneRegionId()"));
        uVar10.d(']');
        uVar10.p(d0Var, qVar);
        u uVar11 = new u();
        uVar11.c(pVar);
        uVar11.m(aVar, 4, 10, e0Var);
        uVar11.d('-');
        uVar11.l(j$.time.temporal.a.DAY_OF_YEAR, 3);
        uVar11.o();
        uVar11.c(jVar);
        uVar11.p(d0Var, qVar);
        u uVar12 = new u();
        uVar12.c(pVar);
        uVar12.m(j$.time.temporal.i.c, 4, 10, e0Var);
        uVar12.e("-W");
        uVar12.l(j$.time.temporal.i.b, 2);
        uVar12.d('-');
        j$.time.temporal.a aVar7 = j$.time.temporal.a.DAY_OF_WEEK;
        uVar12.l(aVar7, 1);
        uVar12.o();
        uVar12.c(jVar);
        uVar12.p(d0Var, qVar);
        u uVar13 = new u();
        uVar13.c(pVar);
        uVar13.c(new g());
        f = uVar13.p(d0Var, null);
        u uVar14 = new u();
        uVar14.c(pVar);
        uVar14.l(aVar, 4);
        uVar14.l(aVar2, 2);
        uVar14.l(aVar3, 2);
        uVar14.o();
        uVar14.c(pVar2);
        uVar14.g("+HHMMss", "Z");
        uVar14.c(pVar3);
        uVar14.p(d0Var, qVar);
        HashMap map = new HashMap();
        map.put(1L, "Mon");
        map.put(2L, "Tue");
        map.put(3L, "Wed");
        map.put(4L, "Thu");
        map.put(5L, "Fri");
        map.put(6L, "Sat");
        map.put(7L, "Sun");
        HashMap map2 = new HashMap();
        map2.put(1L, "Jan");
        map2.put(2L, "Feb");
        map2.put(3L, "Mar");
        map2.put(4L, "Apr");
        map2.put(5L, "May");
        map2.put(6L, "Jun");
        map2.put(7L, "Jul");
        map2.put(8L, "Aug");
        map2.put(9L, "Sep");
        map2.put(10L, "Oct");
        map2.put(11L, "Nov");
        map2.put(12L, "Dec");
        u uVar15 = new u();
        uVar15.c(pVar);
        uVar15.c(pVar2);
        uVar15.o();
        uVar15.h(aVar7, map);
        uVar15.e(", ");
        uVar15.n();
        uVar15.m(aVar3, 1, 2, e0.NOT_NEGATIVE);
        uVar15.d(' ');
        uVar15.h(aVar2, map2);
        uVar15.d(' ');
        uVar15.l(aVar, 4);
        uVar15.d(' ');
        uVar15.l(aVar4, 2);
        uVar15.d(':');
        uVar15.l(aVar5, 2);
        uVar15.o();
        uVar15.d(':');
        uVar15.l(aVar6, 2);
        uVar15.n();
        uVar15.d(' ');
        uVar15.g("+HHMM", "GMT");
        RFC_1123_DATE_TIME = uVar15.p(d0.SMART, qVar);
    }

    public DateTimeFormatter(d dVar, Locale locale, d0 d0Var, j$.time.chrono.j jVar) {
        b0 b0Var = b0.a;
        this.a = (d) Objects.requireNonNull(dVar, "printerParser");
        this.b = (Locale) Objects.requireNonNull(locale, "locale");
        this.c = (b0) Objects.requireNonNull(b0Var, "decimalStyle");
        this.d = (d0) Objects.requireNonNull(d0Var, "resolverStyle");
        this.e = jVar;
    }

    /* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
    /* JADX WARN: Removed duplicated region for block: B:120:0x01b4  */
    /* JADX WARN: Removed duplicated region for block: B:120:0x01b4 A[FALL_THROUGH] */
    /* JADX WARN: Removed duplicated region for block: B:160:0x023a  */
    /* JADX WARN: Removed duplicated region for block: B:261:0x03b6  */
    /* JADX WARN: Removed duplicated region for block: B:312:0x03cf A[SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public static DateTimeFormatter ofPattern(String str) {
        boolean z;
        int i;
        int i2;
        u uVar = new u();
        Objects.requireNonNull(str, "pattern");
        int i3 = 0;
        while (i3 < str.length()) {
            char cCharAt = str.charAt(i3);
            if ((cCharAt >= 'A' && cCharAt <= 'Z') || (cCharAt >= 'a' && cCharAt <= 'z')) {
                int i4 = i3 + 1;
                while (i4 < str.length() && str.charAt(i4) == cCharAt) {
                    i4++;
                }
                int i5 = i4 - i3;
                if (cCharAt == 'p') {
                    if (i4 >= str.length() || (((cCharAt = str.charAt(i4)) < 'A' || cCharAt > 'Z') && (cCharAt < 'a' || cCharAt > 'z'))) {
                        i = i4;
                        i2 = i5;
                        i5 = 0;
                    } else {
                        i = i4 + 1;
                        while (i < str.length() && str.charAt(i) == cCharAt) {
                            i++;
                        }
                        i2 = i - i4;
                    }
                    if (i5 == 0) {
                        j$.time.g.c("Pad letter 'p' must be followed by valid pad pattern: ".concat(str));
                        return null;
                    }
                    if (i5 < 1) {
                        j$.time.g.l("The pad width must be at least one but was ", i5);
                        return null;
                    }
                    u uVar2 = uVar.a;
                    uVar2.e = i5;
                    uVar2.f = ' ';
                    uVar2.g = -1;
                    i5 = i2;
                    i4 = i;
                }
                char c = cCharAt;
                j$.time.temporal.o oVar = (j$.time.temporal.o) ((HashMap) u.i).get(Character.valueOf(c));
                if (oVar != null) {
                    if (c == 'A') {
                        uVar.m(oVar, i5, 19, e0.NOT_NEGATIVE);
                    } else {
                        if (c == 'Q') {
                            z = false;
                        } else if (c == 'S') {
                            uVar.b(j$.time.temporal.a.NANO_OF_SECOND, i5, i5, false);
                        } else if (c == 'a') {
                            if (i5 != 1) {
                                j$.time.g.m("Too many pattern letters: ", c);
                                return null;
                            }
                            uVar.i(oVar, TextStyle.SHORT);
                        } else if (c == 'k') {
                            if (i5 == 1) {
                                uVar.k(oVar);
                            } else {
                                if (i5 != 2) {
                                    j$.time.g.m("Too many pattern letters: ", c);
                                    return null;
                                }
                                uVar.l(oVar, i5);
                            }
                        } else if (c == 'q') {
                            z = true;
                        } else if (c != 's') {
                            if (c == 'u' || c == 'y') {
                                if (i5 == 2) {
                                    LocalDate localDate = o.h;
                                    Objects.requireNonNull(oVar, "field");
                                    Objects.requireNonNull(localDate, "baseDate");
                                    o oVar2 = new o(oVar, 2, 2, localDate, 0);
                                    if (localDate == null) {
                                        if (!oVar.q().e(0L)) {
                                            j$.time.g.c("The base value must be within the range of the field");
                                            return null;
                                        }
                                        if (i.f[2] > 2147483647L) {
                                            j$.time.g.k("Unable to add printer-parser as the range exceeds the capacity of an int");
                                            return null;
                                        }
                                    }
                                    uVar.j(oVar2);
                                } else if (i5 < 4) {
                                    uVar.m(oVar, i5, 19, e0.NORMAL);
                                } else {
                                    uVar.m(oVar, i5, 19, e0.EXCEEDS_PAD);
                                }
                            } else if (c == 'g') {
                                uVar.m(oVar, i5, 19, e0.NORMAL);
                            } else if (c != 'h' && c != 'm') {
                                if (c != 'n') {
                                    switch (c) {
                                        case 'D':
                                            if (i5 == 1) {
                                                uVar.k(oVar);
                                            } else {
                                                if (i5 != 2 && i5 != 3) {
                                                    j$.time.g.m("Too many pattern letters: ", c);
                                                    return null;
                                                }
                                                uVar.m(oVar, i5, 3, e0.NOT_NEGATIVE);
                                            }
                                            break;
                                        case 'E':
                                            z = false;
                                            break;
                                        case 'F':
                                            if (i5 != 1) {
                                                j$.time.g.m("Too many pattern letters: ", c);
                                                return null;
                                            }
                                            uVar.k(oVar);
                                            break;
                                            break;
                                        case 'G':
                                            if (i5 == 1 || i5 == 2 || i5 == 3) {
                                                uVar.i(oVar, TextStyle.SHORT);
                                            } else if (i5 == 4) {
                                                uVar.i(oVar, TextStyle.FULL);
                                            } else {
                                                if (i5 != 5) {
                                                    j$.time.g.m("Too many pattern letters: ", c);
                                                    return null;
                                                }
                                                uVar.i(oVar, TextStyle.NARROW);
                                            }
                                            break;
                                        default:
                                            switch (c) {
                                                case 'K':
                                                    break;
                                                case 'L':
                                                    z = true;
                                                    break;
                                                case 'M':
                                                    z = false;
                                                    break;
                                                case 'N':
                                                    break;
                                                default:
                                                    switch (c) {
                                                        case 'c':
                                                            if (i5 == 1) {
                                                                uVar.j(new r(c, i5, i5, i5, 0));
                                                            } else {
                                                                if (i5 == 2) {
                                                                    j$.time.g.c("Invalid pattern \"cc\"");
                                                                    return null;
                                                                }
                                                                z = true;
                                                            }
                                                            break;
                                                        case 'd':
                                                            break;
                                                        case 'e':
                                                            z = false;
                                                            break;
                                                        default:
                                                            if (i5 != 1) {
                                                                uVar.l(oVar, i5);
                                                            } else {
                                                                uVar.k(oVar);
                                                            }
                                                            break;
                                                    }
                                                    break;
                                            }
                                        case 'H':
                                            break;
                                    }
                                }
                            }
                        }
                        if (i5 == 1 || i5 == 2) {
                            if (c == 'e') {
                                uVar.j(new r(c, i5, i5, i5, 0));
                            } else if (c == 'E') {
                                uVar.i(oVar, TextStyle.SHORT);
                            } else if (i5 == 1) {
                                uVar.k(oVar);
                            } else {
                                uVar.l(oVar, 2);
                            }
                        } else if (i5 == 3) {
                            uVar.i(oVar, z ? TextStyle.SHORT_STANDALONE : TextStyle.SHORT);
                        } else if (i5 == 4) {
                            uVar.i(oVar, z ? TextStyle.FULL_STANDALONE : TextStyle.FULL);
                        } else {
                            if (i5 != 5) {
                                j$.time.g.m("Too many pattern letters: ", c);
                                return null;
                            }
                            uVar.i(oVar, z ? TextStyle.NARROW_STANDALONE : TextStyle.NARROW);
                        }
                    }
                } else if (c == 'z') {
                    if (i5 > 4) {
                        j$.time.g.m("Too many pattern letters: ", c);
                        return null;
                    }
                    if (i5 == 4) {
                        uVar.c(new t(TextStyle.FULL, false));
                    } else {
                        uVar.c(new t(TextStyle.SHORT, false));
                    }
                } else if (c == 'V') {
                    if (i5 != 2) {
                        j$.time.g.m("Pattern letter count must be 2: ", c);
                        return null;
                    }
                    uVar.c(new s(j$.time.temporal.p.a, "ZoneId()"));
                } else if (c != 'v') {
                    String str2 = "+0000";
                    if (c == 'Z') {
                        if (i5 < 4) {
                            uVar.g("+HHMM", "+0000");
                        } else if (i5 == 4) {
                            uVar.f(TextStyle.FULL);
                        } else {
                            if (i5 != 5) {
                                j$.time.g.m("Too many pattern letters: ", c);
                                return null;
                            }
                            uVar.g("+HH:MM:ss", "Z");
                        }
                    } else if (c == 'O') {
                        if (i5 == 1) {
                            uVar.f(TextStyle.SHORT);
                        } else {
                            if (i5 != 4) {
                                j$.time.g.m("Pattern letter count must be 1 or 4: ", c);
                                return null;
                            }
                            uVar.f(TextStyle.FULL);
                        }
                    } else if (c == 'X') {
                        if (i5 > 5) {
                            j$.time.g.m("Too many pattern letters: ", c);
                            return null;
                        }
                        uVar.g(j.d[i5 + (i5 == 1 ? 0 : 1)], "Z");
                    } else if (c == 'x') {
                        if (i5 > 5) {
                            j$.time.g.m("Too many pattern letters: ", c);
                            return null;
                        }
                        if (i5 == 1) {
                            str2 = "+00";
                        } else if (i5 % 2 != 0) {
                            str2 = "+00:00";
                        }
                        uVar.g(j.d[i5 + (i5 == 1 ? 0 : 1)], str2);
                    } else if (c == 'W') {
                        if (i5 > 1) {
                            j$.time.g.m("Too many pattern letters: ", c);
                            return null;
                        }
                        uVar.j(new r(c, i5, i5, i5, 0));
                    } else if (c == 'w') {
                        if (i5 > 2) {
                            j$.time.g.m("Too many pattern letters: ", c);
                            return null;
                        }
                        uVar.j(new r(c, i5, i5, 2, 0));
                    } else {
                        if (c != 'Y') {
                            j$.time.g.m("Unknown pattern letter: ", c);
                            return null;
                        }
                        if (i5 == 2) {
                            uVar.j(new r(c, i5, i5, 2, 0));
                        } else {
                            int i6 = i5;
                            uVar.j(new r(c, i6, i6, 19, 0));
                        }
                    }
                } else if (i5 == 1) {
                    uVar.c(new t(TextStyle.SHORT, true));
                } else {
                    if (i5 != 4) {
                        j$.time.g.m("Wrong number of  pattern letters: ", c);
                        return null;
                    }
                    uVar.c(new t(TextStyle.FULL, true));
                }
                i3 = i4 - 1;
            } else if (cCharAt == '\'') {
                int i7 = i3 + 1;
                int i8 = i7;
                while (i8 < str.length()) {
                    if (str.charAt(i8) == '\'') {
                        int i9 = i8 + 1;
                        if (i9 < str.length() && str.charAt(i9) == '\'') {
                            i8 = i9;
                        } else {
                            if (i8 < str.length()) {
                                j$.time.g.c("Pattern ends with an incomplete string literal: ".concat(str));
                                return null;
                            }
                            String strSubstring = str.substring(i7, i8);
                            if (strSubstring.isEmpty()) {
                                uVar.d('\'');
                            } else {
                                uVar.e(strSubstring.replace("''", "'"));
                            }
                            i3 = i8;
                        }
                    }
                    i8++;
                }
                if (i8 < str.length()) {
                }
            } else if (cCharAt == '[') {
                uVar.o();
            } else if (cCharAt == ']') {
                if (uVar.a.b == null) {
                    j$.time.g.c("Pattern invalid as it contains ] without previous [");
                    return null;
                }
                uVar.n();
            } else {
                if (cCharAt == '{' || cCharAt == '}' || cCharAt == '#') {
                    throw new IllegalArgumentException("Pattern includes reserved character: '" + cCharAt + "'");
                }
                uVar.d(cCharAt);
            }
            i3++;
        }
        return uVar.q(Locale.getDefault(), d0.SMART, null);
    }

    public final Object a(CharSequence charSequence, j$.time.f fVar) {
        String string;
        Objects.requireNonNull(charSequence, "text");
        Objects.requireNonNull(fVar, "query");
        try {
            return b(charSequence).G(fVar);
        } catch (DateTimeParseException e) {
            throw e;
        } catch (RuntimeException e2) {
            if (charSequence.length() > 64) {
                string = charSequence.subSequence(0, 64).toString() + "...";
            } else {
                string = charSequence.toString();
            }
            DateTimeParseException dateTimeParseException = new DateTimeParseException("Text '" + string + "' could not be parsed: " + e2.getMessage(), e2);
            charSequence.toString();
            throw dateTimeParseException;
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:132:0x0320  */
    /* JADX WARN: Removed duplicated region for block: B:93:0x0265  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final c0 b(CharSequence charSequence) {
        long j;
        int i = 0;
        ParsePosition parsePosition = new ParsePosition(0);
        Objects.requireNonNull(charSequence, "text");
        Objects.requireNonNull(parsePosition, "position");
        v vVar = new v(this);
        int iL = this.a.l(vVar, charSequence, parsePosition.getIndex());
        if (iL < 0) {
            parsePosition.setErrorIndex(~iL);
            vVar = null;
        } else {
            parsePosition.setIndex(iL);
        }
        if (vVar != null) {
            DateTimeFormatter dateTimeFormatter = vVar.a;
            if (parsePosition.getErrorIndex() < 0 && parsePosition.getIndex() >= charSequence.length()) {
                c0 c0VarC = vVar.c();
                j$.time.chrono.j jVar = vVar.c().c;
                if (jVar == null && (jVar = dateTimeFormatter.e) == null) {
                    jVar = j$.time.chrono.q.c;
                }
                c0VarC.c = jVar;
                ZoneId zoneId = c0VarC.b;
                if (zoneId == null) {
                    dateTimeFormatter.getClass();
                    zoneId = null;
                }
                c0VarC.b = zoneId;
                c0VarC.e = this.d;
                c0VarC.j();
                c0VarC.t(c0VarC.c.N(c0VarC.a, c0VarC.e));
                c0VarC.p();
                if (((HashMap) c0VarC.a).size() > 0) {
                    loop0: while (i < 50) {
                        Iterator it = ((HashMap) c0VarC.a).entrySet().iterator();
                        while (it.hasNext()) {
                            j$.time.temporal.o oVar = (j$.time.temporal.o) ((Map.Entry) it.next()).getKey();
                            TemporalAccessor temporalAccessorM = oVar.m(c0VarC.a, c0VarC, c0VarC.e);
                            if (temporalAccessorM == null) {
                                if (!((HashMap) c0VarC.a).containsKey(oVar)) {
                                    break;
                                }
                            } else {
                                if (temporalAccessorM instanceof ChronoZonedDateTime) {
                                    ChronoZonedDateTime chronoZonedDateTime = (ChronoZonedDateTime) temporalAccessorM;
                                    ZoneId zoneId2 = c0VarC.b;
                                    if (zoneId2 == null) {
                                        c0VarC.b = chronoZonedDateTime.D();
                                    } else if (!zoneId2.equals(chronoZonedDateTime.D())) {
                                        throw new DateTimeException("ChronoZonedDateTime must use the effective parsed zone: " + c0VarC.b);
                                    }
                                    temporalAccessorM = chronoZonedDateTime.r();
                                }
                                if (temporalAccessorM instanceof ChronoLocalDateTime) {
                                    ChronoLocalDateTime chronoLocalDateTime = (ChronoLocalDateTime) temporalAccessorM;
                                    c0VarC.q(chronoLocalDateTime.b(), j$.time.r.d);
                                    c0VarC.t(chronoLocalDateTime.f());
                                } else if (temporalAccessorM instanceof ChronoLocalDate) {
                                    c0VarC.t((ChronoLocalDate) temporalAccessorM);
                                } else {
                                    if (!(temporalAccessorM instanceof j$.time.j)) {
                                        j$.time.g.k("Method resolve() can only return ChronoZonedDateTime, ChronoLocalDateTime, ChronoLocalDate or LocalTime");
                                        return null;
                                    }
                                    c0VarC.q((j$.time.j) temporalAccessorM, j$.time.r.d);
                                }
                            }
                            i++;
                        }
                    }
                    if (i == 50) {
                        j$.time.g.k("One of the parsed fields has an incorrectly implemented resolve method");
                        return null;
                    }
                    if (i > 0) {
                        c0VarC.j();
                        c0VarC.t(c0VarC.c.N(c0VarC.a, c0VarC.e));
                        c0VarC.p();
                    }
                }
                if (c0VarC.g == null) {
                    Map map = c0VarC.a;
                    j$.time.temporal.a aVar = j$.time.temporal.a.MILLI_OF_SECOND;
                    boolean zContainsKey = ((HashMap) map).containsKey(aVar);
                    Map map2 = c0VarC.a;
                    if (zContainsKey) {
                        long jLongValue = ((Long) ((HashMap) map2).remove(aVar)).longValue();
                        Map map3 = c0VarC.a;
                        j$.time.temporal.a aVar2 = j$.time.temporal.a.MICRO_OF_SECOND;
                        boolean zContainsKey2 = ((HashMap) map3).containsKey(aVar2);
                        Map map4 = c0VarC.a;
                        if (zContainsKey2) {
                            long jLongValue2 = (((Long) ((HashMap) map4).get(aVar2)).longValue() % 1000) + (jLongValue * 1000);
                            c0VarC.v(aVar, aVar2, Long.valueOf(jLongValue2));
                            ((HashMap) c0VarC.a).remove(aVar2);
                            ((HashMap) c0VarC.a).put(j$.time.temporal.a.NANO_OF_SECOND, Long.valueOf(jLongValue2 * 1000));
                        } else {
                            ((HashMap) map4).put(j$.time.temporal.a.NANO_OF_SECOND, Long.valueOf(jLongValue * 1000000));
                        }
                    } else {
                        j$.time.temporal.a aVar3 = j$.time.temporal.a.MICRO_OF_SECOND;
                        if (((HashMap) map2).containsKey(aVar3)) {
                            ((HashMap) c0VarC.a).put(j$.time.temporal.a.NANO_OF_SECOND, Long.valueOf(((Long) ((HashMap) c0VarC.a).remove(aVar3)).longValue() * 1000));
                        }
                    }
                    Map map5 = c0VarC.a;
                    j$.time.temporal.a aVar4 = j$.time.temporal.a.HOUR_OF_DAY;
                    Long l = (Long) ((HashMap) map5).get(aVar4);
                    if (l != null) {
                        Map map6 = c0VarC.a;
                        j$.time.temporal.a aVar5 = j$.time.temporal.a.MINUTE_OF_HOUR;
                        Long l2 = (Long) ((HashMap) map6).get(aVar5);
                        Map map7 = c0VarC.a;
                        j$.time.temporal.a aVar6 = j$.time.temporal.a.SECOND_OF_MINUTE;
                        Long l3 = (Long) ((HashMap) map7).get(aVar6);
                        Map map8 = c0VarC.a;
                        j$.time.temporal.a aVar7 = j$.time.temporal.a.NANO_OF_SECOND;
                        Long l4 = (Long) ((HashMap) map8).get(aVar7);
                        if ((l2 != null || (l3 == null && l4 == null)) && (l2 == null || l3 != null || l4 == null)) {
                            j = 1000000;
                            c0VarC.o(l.longValue(), l2 != null ? l2.longValue() : 0L, l3 != null ? l3.longValue() : 0L, l4 != null ? l4.longValue() : 0L);
                            ((HashMap) c0VarC.a).remove(aVar4);
                            ((HashMap) c0VarC.a).remove(aVar5);
                            ((HashMap) c0VarC.a).remove(aVar6);
                            ((HashMap) c0VarC.a).remove(aVar7);
                        } else {
                            j = 1000000;
                        }
                    } else {
                        j = 1000000;
                    }
                    if (c0VarC.e != d0.LENIENT && ((HashMap) c0VarC.a).size() > 0) {
                        for (Map.Entry entry : ((HashMap) c0VarC.a).entrySet()) {
                            j$.time.temporal.o oVar2 = (j$.time.temporal.o) entry.getKey();
                            if (oVar2 instanceof j$.time.temporal.a) {
                                j$.time.temporal.a aVar8 = (j$.time.temporal.a) oVar2;
                                if (aVar8.S()) {
                                    aVar8.G(((Long) entry.getValue()).longValue());
                                }
                            }
                        }
                    }
                }
                ChronoLocalDate chronoLocalDate = c0VarC.f;
                if (chronoLocalDate != null) {
                    c0VarC.i(chronoLocalDate);
                }
                j$.time.j jVar2 = c0VarC.g;
                if (jVar2 != null) {
                    c0VarC.i(jVar2);
                    if (c0VarC.f != null && ((HashMap) c0VarC.a).size() > 0) {
                        c0VarC.i(c0VarC.f.H(c0VarC.g));
                    }
                }
                if (c0VarC.f != null && c0VarC.g != null) {
                    j$.time.r rVar = c0VarC.h;
                    rVar.getClass();
                    j$.time.r rVar2 = j$.time.r.d;
                    if (rVar != rVar2) {
                        c0VarC.f = c0VarC.f.M(c0VarC.h);
                        c0VarC.h = rVar2;
                    }
                }
                if (c0VarC.g == null) {
                    if (!((HashMap) c0VarC.a).containsKey(j$.time.temporal.a.INSTANT_SECONDS)) {
                        if (!((HashMap) c0VarC.a).containsKey(j$.time.temporal.a.SECOND_OF_DAY)) {
                            if (((HashMap) c0VarC.a).containsKey(j$.time.temporal.a.SECOND_OF_MINUTE)) {
                                Map map9 = c0VarC.a;
                                j$.time.temporal.a aVar9 = j$.time.temporal.a.NANO_OF_SECOND;
                                boolean zContainsKey3 = ((HashMap) map9).containsKey(aVar9);
                                Map map10 = c0VarC.a;
                                if (zContainsKey3) {
                                    long jLongValue3 = ((Long) ((HashMap) map10).get(aVar9)).longValue();
                                    ((HashMap) c0VarC.a).put(j$.time.temporal.a.MICRO_OF_SECOND, Long.valueOf(jLongValue3 / 1000));
                                    ((HashMap) c0VarC.a).put(j$.time.temporal.a.MILLI_OF_SECOND, Long.valueOf(jLongValue3 / j));
                                } else {
                                    ((HashMap) map10).put(aVar9, 0L);
                                    ((HashMap) c0VarC.a).put(j$.time.temporal.a.MICRO_OF_SECOND, 0L);
                                    ((HashMap) c0VarC.a).put(j$.time.temporal.a.MILLI_OF_SECOND, 0L);
                                }
                            }
                        }
                    }
                }
                if (c0VarC.f != null && c0VarC.g != null) {
                    Long l5 = (Long) ((HashMap) c0VarC.a).get(j$.time.temporal.a.OFFSET_SECONDS);
                    if (l5 != null) {
                        ((HashMap) c0VarC.a).put(j$.time.temporal.a.INSTANT_SECONDS, Long.valueOf(c0VarC.f.H(c0VarC.g).B(ZoneOffset.b0(l5.intValue())).toEpochSecond()));
                        return c0VarC;
                    }
                    if (c0VarC.b != null) {
                        ((HashMap) c0VarC.a).put(j$.time.temporal.a.INSTANT_SECONDS, Long.valueOf(c0VarC.f.H(c0VarC.g).B(c0VarC.b).toEpochSecond()));
                    }
                }
                return c0VarC;
            }
        }
        String string = charSequence.length() > 64 ? charSequence.subSequence(0, 64).toString() + "..." : charSequence.toString();
        if (parsePosition.getErrorIndex() >= 0) {
            String str = "Text '" + string + "' could not be parsed at index " + parsePosition.getErrorIndex();
            parsePosition.getErrorIndex();
            throw new DateTimeParseException(str, charSequence);
        }
        String str2 = "Text '" + string + "' could not be parsed, unparsed text found at index " + parsePosition.getIndex();
        parsePosition.getIndex();
        throw new DateTimeParseException(str2, charSequence);
    }

    public String format(TemporalAccessor temporalAccessor) {
        StringBuilder sb = new StringBuilder(32);
        d dVar = this.a;
        Objects.requireNonNull(temporalAccessor, "temporal");
        Objects.requireNonNull(sb, "appendable");
        try {
            dVar.k(new x(temporalAccessor, this), sb);
            return sb.toString();
        } catch (IOException e) {
            throw new DateTimeException(e.getMessage(), e);
        }
    }

    public final String toString() {
        String string = this.a.toString();
        return string.startsWith("[") ? string : string.substring(1, string.length() - 1);
    }
}
