package o;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.Lt, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C0304Lt implements Comparable {
    public static final long m;
    public static final long n;

    /* renamed from: o, reason: collision with root package name */
    public static final /* synthetic */ int f217o = 0;
    public final long l;

    static {
        int i = AbstractC0356Nt.a;
        m = AbstractC1904ms0.e(4611686018427387903L);
        n = AbstractC1904ms0.e(-4611686018427387903L);
    }

    public static final void a(StringBuilder sb, int i, int i2, int i3, String str, boolean z) {
        CharSequence charSequenceSubSequence;
        sb.append(i);
        if (i2 != 0) {
            sb.append('.');
            String strValueOf = String.valueOf(i2);
            if (i3 < 0) {
                throw new IllegalArgumentException(AbstractC0126Ew.k(i3, "Desired length ", " is less than zero."));
            }
            if (i3 <= strValueOf.length()) {
                charSequenceSubSequence = strValueOf.subSequence(0, strValueOf.length());
            } else {
                StringBuilder sb2 = new StringBuilder(i3);
                int length = i3 - strValueOf.length();
                int i4 = 1;
                if (1 <= length) {
                    while (true) {
                        sb2.append('0');
                        if (i4 == length) {
                            break;
                        } else {
                            i4++;
                        }
                    }
                }
                sb2.append((CharSequence) strValueOf);
                charSequenceSubSequence = sb2;
            }
            String string = charSequenceSubSequence.toString();
            int i5 = -1;
            int length2 = string.length() - 1;
            if (length2 >= 0) {
                while (true) {
                    int i6 = length2 - 1;
                    if (string.charAt(length2) != '0') {
                        i5 = length2;
                        break;
                    } else if (i6 < 0) {
                        break;
                    } else {
                        length2 = i6;
                    }
                }
            }
            int i7 = i5 + 1;
            if (z || i7 >= 3) {
                sb.append((CharSequence) string, 0, ((i5 + 3) / 3) * 3);
            } else {
                sb.append((CharSequence) string, 0, i7);
            }
        }
        sb.append(str);
    }

    public static int b(long j, long j2) {
        long j3 = j ^ j2;
        if (j3 < 0 || (((int) j3) & 1) == 0) {
            return F3.n(j, j2);
        }
        int i = (((int) j) & 1) - (((int) j2) & 1);
        return j < 0 ? -i : i;
    }

    public static final boolean c(long j) {
        return j == m || j == n;
    }

    public static final long d(long j, EnumC0382Ot enumC0382Ot) {
        if (j == m) {
            return Long.MAX_VALUE;
        }
        if (j == n) {
            return Long.MIN_VALUE;
        }
        return enumC0382Ot.l.convert(j >> 1, ((((int) j) & 1) == 0 ? EnumC0382Ot.NANOSECONDS : EnumC0382Ot.MILLISECONDS).l);
    }

    @Override // java.lang.Comparable
    public final int compareTo(Object obj) {
        return b(this.l, ((C0304Lt) obj).l);
    }

    public final boolean equals(Object obj) {
        if (obj instanceof C0304Lt) {
            return this.l == ((C0304Lt) obj).l;
        }
        return false;
    }

    public final int hashCode() {
        return Long.hashCode(this.l);
    }

    public final String toString() {
        long j;
        int iD;
        int i;
        long j2;
        int i2;
        int i3;
        long j3 = this.l;
        if (j3 == 0) {
            return "0s";
        }
        if (j3 == m) {
            return "Infinity";
        }
        if (j3 == n) {
            return "-Infinity";
        }
        boolean z = j3 < 0;
        StringBuilder sb = new StringBuilder();
        if (z) {
            sb.append('-');
        }
        if (j3 < 0) {
            j3 = (((int) j3) & 1) + ((-(j3 >> 1)) << 1);
            int i4 = AbstractC0356Nt.a;
        }
        long jD = d(j3, EnumC0382Ot.DAYS);
        int iD2 = c(j3) ? 0 : (int) (d(j3, EnumC0382Ot.HOURS) % 24);
        if (c(j3)) {
            j = 0;
            iD = 0;
        } else {
            j = 0;
            iD = (int) (d(j3, EnumC0382Ot.MINUTES) % 60);
        }
        int iD3 = c(j3) ? 0 : (int) (d(j3, EnumC0382Ot.SECONDS) % 60);
        if (c(j3)) {
            i = 1;
            i2 = 0;
        } else {
            if ((((int) j3) & 1) == 1) {
                i = 1;
                j2 = ((j3 >> 1) % 1000) * 1000000;
            } else {
                i = 1;
                j2 = (j3 >> 1) % 1000000000;
            }
            i2 = (int) j2;
        }
        int i5 = jD != j ? i : 0;
        int i6 = iD2 != 0 ? i : 0;
        int i7 = iD != 0 ? i : 0;
        int i8 = (iD3 == 0 && i2 == 0) ? 0 : i;
        if (i5 != 0) {
            sb.append(jD);
            sb.append('d');
            i3 = i;
        } else {
            i3 = 0;
        }
        if (i6 != 0 || (i5 != 0 && (i7 != 0 || i8 != 0))) {
            int i9 = i3 + 1;
            if (i3 > 0) {
                sb.append(' ');
            }
            sb.append(iD2);
            sb.append('h');
            i3 = i9;
        }
        if (i7 != 0 || (i8 != 0 && (i6 != 0 || i5 != 0))) {
            int i10 = i3 + 1;
            if (i3 > 0) {
                sb.append(' ');
            }
            sb.append(iD);
            sb.append('m');
            i3 = i10;
        }
        if (i8 != 0) {
            int i11 = i3 + 1;
            if (i3 > 0) {
                sb.append(' ');
            }
            if (iD3 != 0 || i5 != 0 || i6 != 0 || i7 != 0) {
                a(sb, iD3, i2, 9, "s", false);
            } else if (i2 >= 1000000) {
                a(sb, i2 / 1000000, i2 % 1000000, 6, "ms", false);
            } else if (i2 >= 1000) {
                a(sb, i2 / 1000, i2 % 1000, 3, "us", false);
            } else {
                sb.append(i2);
                sb.append("ns");
            }
            i3 = i11;
        }
        if (z && i3 > i) {
            sb.insert(i, '(').append(')');
        }
        return sb.toString();
    }
}
