package j$.time;

import androidx.media3.common.C;
import androidx.media3.common.PlaybackException;
import com.revenuecat.purchases.common.Constants;
import java.io.DataOutput;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.util.Objects;

/* JADX INFO: loaded from: classes2.dex */
public final class l implements j$.time.temporal.m, j$.time.temporal.o, Comparable, Serializable {

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public static final l f19304e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static final l f19305f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public static final l f19306g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    private static final l[] f19307h = new l[24];
    private static final long serialVersionUID = 6414437269572265201L;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private final byte f19308a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final byte f19309b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private final byte f19310c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private final int f19311d;

    static {
        int i6 = 0;
        while (true) {
            l[] lVarArr = f19307h;
            if (i6 < lVarArr.length) {
                lVarArr[i6] = new l(i6, 0, 0, 0);
                i6++;
            } else {
                l lVar = lVarArr[0];
                f19306g = lVar;
                l lVar2 = lVarArr[12];
                f19304e = lVar;
                f19305f = new l(23, 59, 59, 999999999);
                return;
            }
        }
    }

    public static l c0(int i6) {
        j$.time.temporal.a.HOUR_OF_DAY.c0(i6);
        return f19307h[i6];
    }

    public static l d0(int i6, int i7, int i8, int i9) {
        j$.time.temporal.a.HOUR_OF_DAY.c0(i6);
        j$.time.temporal.a.MINUTE_OF_HOUR.c0(i7);
        j$.time.temporal.a.SECOND_OF_MINUTE.c0(i8);
        j$.time.temporal.a.NANO_OF_SECOND.c0(i9);
        return B(i6, i7, i8, i9);
    }

    public static l f0(long j4) {
        j$.time.temporal.a.SECOND_OF_DAY.c0(j4);
        int i6 = (int) (j4 / 3600);
        long j6 = j4 - ((long) (i6 * 3600));
        int i7 = (int) (j6 / 60);
        return B(i6, i7, (int) (j6 - ((long) (i7 * 60))), 0);
    }

    public static l e0(long j4) {
        j$.time.temporal.a.NANO_OF_DAY.c0(j4);
        int i6 = (int) (j4 / 3600000000000L);
        long j6 = j4 - (((long) i6) * 3600000000000L);
        int i7 = (int) (j6 / 60000000000L);
        long j7 = j6 - (((long) i7) * 60000000000L);
        int i8 = (int) (j7 / C.NANOS_PER_SECOND);
        return B(i6, i7, i8, (int) (j7 - (((long) i8) * C.NANOS_PER_SECOND)));
    }

    public static l J(j$.time.temporal.n nVar) {
        Objects.requireNonNull(nVar, "temporal");
        l lVar = (l) nVar.d(j$.time.temporal.t.c());
        if (lVar != null) {
            return lVar;
        }
        throw new c("Unable to obtain LocalTime from TemporalAccessor: " + nVar + " of type " + nVar.getClass().getName());
    }

    private static l B(int i6, int i7, int i8, int i9) {
        if ((i7 | i8 | i9) == 0) {
            return f19307h[i6];
        }
        return new l(i6, i7, i8, i9);
    }

    private l(int i6, int i7, int i8, int i9) {
        this.f19308a = (byte) i6;
        this.f19309b = (byte) i7;
        this.f19310c = (byte) i8;
        this.f19311d = i9;
    }

    @Override // j$.time.temporal.n
    public final boolean f(j$.time.temporal.s sVar) {
        if (sVar instanceof j$.time.temporal.a) {
            return ((j$.time.temporal.a) sVar).d0();
        }
        return sVar != null && sVar.Y(this);
    }

    @Override // j$.time.temporal.n
    public final int j(j$.time.temporal.s sVar) {
        if (sVar instanceof j$.time.temporal.a) {
            return U(sVar);
        }
        return super.j(sVar);
    }

    @Override // j$.time.temporal.n
    public final long g(j$.time.temporal.s sVar) {
        if (sVar instanceof j$.time.temporal.a) {
            if (sVar == j$.time.temporal.a.NANO_OF_DAY) {
                return m0();
            }
            if (sVar == j$.time.temporal.a.MICRO_OF_DAY) {
                return m0() / 1000;
            }
            return U(sVar);
        }
        return sVar.r(this);
    }

    private int U(j$.time.temporal.s sVar) {
        int i6 = k.f19302a[((j$.time.temporal.a) sVar).ordinal()];
        byte b5 = this.f19309b;
        int i7 = this.f19311d;
        byte b6 = this.f19308a;
        switch (i6) {
            case 1:
                return i7;
            case 2:
                throw new j$.time.temporal.w("Invalid field 'NanoOfDay' for get() method, use getLong() instead");
            case 3:
                return i7 / 1000;
            case 4:
                throw new j$.time.temporal.w("Invalid field 'MicroOfDay' for get() method, use getLong() instead");
            case 5:
                return i7 / PlaybackException.CUSTOM_ERROR_CODE_BASE;
            case 6:
                return (int) (m0() / 1000000);
            case 7:
                return this.f19310c;
            case 8:
                return n0();
            case 9:
                return b5;
            case 10:
                return (b6 * 60) + b5;
            case 11:
                return b6 % 12;
            case 12:
                int i8 = b6 % 12;
                if (i8 % 12 == 0) {
                    return 12;
                }
                return i8;
            case 14:
                if (b6 == 0) {
                    return 24;
                }
            case 13:
                return b6;
            case 15:
                return b6 / 12;
            default:
                throw new j$.time.temporal.w(d.a("Unsupported field: ", sVar));
        }
    }

    public final int V() {
        return this.f19308a;
    }

    public final int b0() {
        return this.f19310c;
    }

    public final int Y() {
        return this.f19311d;
    }

    @Override // j$.time.temporal.m
    /* JADX INFO: renamed from: h */
    public final j$.time.temporal.m m(LocalDate localDate) {
        return (l) localDate.e(this);
    }

    @Override // j$.time.temporal.m
    /* JADX INFO: renamed from: o0, reason: merged with bridge method [inline-methods] */
    public final l a(long j4, j$.time.temporal.s sVar) {
        if (!(sVar instanceof j$.time.temporal.a)) {
            return (l) sVar.p(this, j4);
        }
        j$.time.temporal.a aVar = (j$.time.temporal.a) sVar;
        aVar.c0(j4);
        int i6 = k.f19302a[aVar.ordinal()];
        byte b5 = this.f19309b;
        byte b6 = this.f19310c;
        int i7 = this.f19311d;
        byte b7 = this.f19308a;
        switch (i6) {
            case 1:
                return p0((int) j4);
            case 2:
                return e0(j4);
            case 3:
                return p0(((int) j4) * 1000);
            case 4:
                return e0(j4 * 1000);
            case 5:
                return p0(((int) j4) * PlaybackException.CUSTOM_ERROR_CODE_BASE);
            case 6:
                return e0(j4 * 1000000);
            case 7:
                int i8 = (int) j4;
                if (b6 != i8) {
                    j$.time.temporal.a.SECOND_OF_MINUTE.c0(i8);
                    return B(b7, b5, i8, i7);
                }
                return this;
            case 8:
                return k0(j4 - ((long) n0()));
            case 9:
                int i9 = (int) j4;
                if (b5 != i9) {
                    j$.time.temporal.a.MINUTE_OF_HOUR.c0(i9);
                    return B(b7, i9, b6, i7);
                }
                return this;
            case 10:
                return i0(j4 - ((long) ((b7 * 60) + b5)));
            case 11:
                return h0(j4 - ((long) (b7 % 12)));
            case 12:
                if (j4 == 12) {
                    j4 = 0;
                }
                return h0(j4 - ((long) (b7 % 12)));
            case 13:
                int i10 = (int) j4;
                if (b7 != i10) {
                    j$.time.temporal.a.HOUR_OF_DAY.c0(i10);
                    return B(i10, b5, b6, i7);
                }
                return this;
            case 14:
                if (j4 == 24) {
                    j4 = 0;
                }
                int i11 = (int) j4;
                if (b7 != i11) {
                    j$.time.temporal.a.HOUR_OF_DAY.c0(i11);
                    return B(i11, b5, b6, i7);
                }
                return this;
            case 15:
                return h0((j4 - ((long) (b7 / 12))) * 12);
            default:
                throw new j$.time.temporal.w(d.a("Unsupported field: ", sVar));
        }
    }

    public final l p0(int i6) {
        if (this.f19311d == i6) {
            return this;
        }
        j$.time.temporal.a.NANO_OF_SECOND.c0(i6);
        return B(this.f19308a, this.f19309b, this.f19310c, i6);
    }

    @Override // j$.time.temporal.m
    /* JADX INFO: renamed from: g0, reason: merged with bridge method [inline-methods] */
    public final l b(long j4, j$.time.temporal.v vVar) {
        if (vVar instanceof j$.time.temporal.b) {
            switch (k.f19303b[((j$.time.temporal.b) vVar).ordinal()]) {
                case 1:
                    return j0(j4);
                case 2:
                    return j0((j4 % 86400000000L) * 1000);
                case 3:
                    return j0((j4 % 86400000) * 1000000);
                case 4:
                    return k0(j4);
                case 5:
                    return i0(j4);
                case 6:
                    return h0(j4);
                case 7:
                    return h0((j4 % 2) * 12);
                default:
                    throw new j$.time.temporal.w("Unsupported unit: " + vVar);
            }
        }
        return (l) vVar.p(this, j4);
    }

    public final l h0(long j4) {
        if (j4 == 0) {
            return this;
        }
        return B(((((int) (j4 % 24)) + this.f19308a) + 24) % 24, this.f19309b, this.f19310c, this.f19311d);
    }

    public final l i0(long j4) {
        if (j4 != 0) {
            int i6 = (this.f19308a * 60) + this.f19309b;
            int i7 = ((((int) (j4 % 1440)) + i6) + 1440) % 1440;
            if (i6 != i7) {
                return B(i7 / 60, i7 % 60, this.f19310c, this.f19311d);
            }
        }
        return this;
    }

    public final l k0(long j4) {
        if (j4 != 0) {
            int i6 = (this.f19309b * 60) + (this.f19308a * 3600) + this.f19310c;
            int i7 = ((((int) (j4 % 86400)) + i6) + 86400) % 86400;
            if (i6 != i7) {
                return B(i7 / 3600, (i7 / 60) % 60, i7 % 60, this.f19311d);
            }
        }
        return this;
    }

    public final l j0(long j4) {
        if (j4 != 0) {
            long jM0 = m0();
            long j6 = (((j4 % 86400000000000L) + jM0) + 86400000000000L) % 86400000000000L;
            if (jM0 != j6) {
                return B((int) (j6 / 3600000000000L), (int) ((j6 / 60000000000L) % 60), (int) ((j6 / C.NANOS_PER_SECOND) % 60), (int) (j6 % C.NANOS_PER_SECOND));
            }
        }
        return this;
    }

    @Override // j$.time.temporal.m
    public final j$.time.temporal.m c(long j4, j$.time.temporal.v vVar) {
        return j4 == Long.MIN_VALUE ? b(Long.MAX_VALUE, vVar).b(1L, vVar) : b(-j4, vVar);
    }

    @Override // j$.time.temporal.n
    public final Object d(j$.time.temporal.u uVar) {
        if (uVar == j$.time.temporal.t.a() || uVar == j$.time.temporal.t.g() || uVar == j$.time.temporal.t.f() || uVar == j$.time.temporal.t.d()) {
            return null;
        }
        if (uVar == j$.time.temporal.t.c()) {
            return this;
        }
        if (uVar == j$.time.temporal.t.b()) {
            return null;
        }
        if (uVar == j$.time.temporal.t.e()) {
            return j$.time.temporal.b.NANOS;
        }
        return uVar.l(this);
    }

    @Override // j$.time.temporal.o
    public final j$.time.temporal.m e(j$.time.temporal.m mVar) {
        return mVar.a(m0(), j$.time.temporal.a.NANO_OF_DAY);
    }

    public final int n0() {
        return (this.f19309b * 60) + (this.f19308a * 3600) + this.f19310c;
    }

    public final long m0() {
        return (((long) this.f19310c) * C.NANOS_PER_SECOND) + (((long) this.f19309b) * 60000000000L) + (((long) this.f19308a) * 3600000000000L) + ((long) this.f19311d);
    }

    @Override // java.lang.Comparable
    /* JADX INFO: renamed from: r, reason: merged with bridge method [inline-methods] */
    public final int compareTo(l lVar) {
        int iCompare = Integer.compare(this.f19308a, lVar.f19308a);
        return (iCompare == 0 && (iCompare = Integer.compare(this.f19309b, lVar.f19309b)) == 0 && (iCompare = Integer.compare(this.f19310c, lVar.f19310c)) == 0) ? Integer.compare(this.f19311d, lVar.f19311d) : iCompare;
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof l) {
            l lVar = (l) obj;
            if (this.f19308a == lVar.f19308a && this.f19309b == lVar.f19309b && this.f19310c == lVar.f19310c && this.f19311d == lVar.f19311d) {
                return true;
            }
        }
        return false;
    }

    public final int hashCode() {
        long jM0 = m0();
        return (int) (jM0 ^ (jM0 >>> 32));
    }

    public final String toString() {
        StringBuilder sb = new StringBuilder(18);
        byte b5 = this.f19308a;
        sb.append(b5 < 10 ? "0" : "");
        sb.append((int) b5);
        String str = Constants.SUBS_ID_BASE_PLAN_ID_SEPARATOR;
        byte b6 = this.f19309b;
        sb.append(b6 < 10 ? ":0" : Constants.SUBS_ID_BASE_PLAN_ID_SEPARATOR);
        sb.append((int) b6);
        byte b7 = this.f19310c;
        int i6 = this.f19311d;
        if (b7 > 0 || i6 > 0) {
            if (b7 < 10) {
                str = ":0";
            }
            sb.append(str);
            sb.append((int) b7);
            if (i6 > 0) {
                sb.append('.');
                if (i6 % PlaybackException.CUSTOM_ERROR_CODE_BASE == 0) {
                    sb.append(Integer.toString((i6 / PlaybackException.CUSTOM_ERROR_CODE_BASE) + 1000).substring(1));
                } else if (i6 % 1000 == 0) {
                    sb.append(Integer.toString((i6 / 1000) + PlaybackException.CUSTOM_ERROR_CODE_BASE).substring(1));
                } else {
                    sb.append(Integer.toString(i6 + 1000000000).substring(1));
                }
            }
        }
        return sb.toString();
    }

    private Object writeReplace() {
        return new t((byte) 4, this);
    }

    private void readObject(ObjectInputStream objectInputStream) throws InvalidObjectException {
        throw new InvalidObjectException("Deserialization via serialization delegate");
    }

    final void q0(DataOutput dataOutput) {
        byte b5 = this.f19310c;
        byte b6 = this.f19308a;
        byte b7 = this.f19309b;
        int i6 = this.f19311d;
        if (i6 != 0) {
            dataOutput.writeByte(b6);
            dataOutput.writeByte(b7);
            dataOutput.writeByte(b5);
            dataOutput.writeInt(i6);
            return;
        }
        if (b5 != 0) {
            dataOutput.writeByte(b6);
            dataOutput.writeByte(b7);
            dataOutput.writeByte(~b5);
        } else if (b7 == 0) {
            dataOutput.writeByte(~b6);
        } else {
            dataOutput.writeByte(b6);
            dataOutput.writeByte(~b7);
        }
    }

    static l l0(ObjectInput objectInput) throws IOException {
        int i6;
        int i7;
        int i8 = objectInput.readByte();
        int i9 = 0;
        if (i8 < 0) {
            i8 = ~i8;
            i7 = 0;
            i6 = 0;
        } else {
            byte b5 = objectInput.readByte();
            if (b5 < 0) {
                int i10 = ~b5;
                i6 = 0;
                i9 = i10;
                i7 = 0;
            } else {
                byte b6 = objectInput.readByte();
                if (b6 < 0) {
                    i7 = ~b6;
                    i6 = 0;
                    i9 = b5;
                } else {
                    i6 = objectInput.readInt();
                    i9 = b5;
                    i7 = b6;
                }
            }
        }
        return d0(i8, i9, i7, i6);
    }
}
