package p463.p484.p485;

import java.io.DataInput;
import java.io.InvalidObjectException;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.regex.Pattern;
import p463.p473.p474.p479.C7158;
import p463.p484.p485.p489.EnumC7260;
import p463.p484.p485.p489.InterfaceC7269;
import p463.p484.p485.p489.InterfaceC7274;

/* JADX INFO: renamed from: ޒ.ށ.֏.ؠ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C7176 implements InterfaceC7274, Comparable<C7176>, Serializable {

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public static final C7176 f20795 = new C7176(0, 0);

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final long f20796;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final int f20797;

    static {
        BigInteger.valueOf(1000000000L);
        Pattern.compile("([-+]?)P(?:([-+]?[0-9]+)D)?(T(?:([-+]?[0-9]+)H)?(?:([-+]?[0-9]+)M)?(?:([-+]?[0-9]+)(?:[.,]([0-9]{0,9}))?S)?)?", 2);
    }

    public C7176(long j, int i) {
        this.f20796 = j;
        this.f20797 = i;
    }

    private Object readResolve() throws InvalidObjectException {
        throw new InvalidObjectException("Deserialization via serialization delegate");
    }

    private Object writeReplace() {
        return new C7188((byte) 1, this);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static C7176 m10598(long j) {
        long j2 = j / 1000000000;
        int i = (int) (j % 1000000000);
        if (i < 0) {
            i += 1000000000;
            j2--;
        }
        return m10599(j2, i);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static C7176 m10599(long j, int i) {
        return (((long) i) | j) == 0 ? f20795 : new C7176(j, i);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static C7176 m10600(long j, long j2) {
        return m10599(C7158.m10550(j, C7158.m10546(j2, 1000000000L)), C7158.m10536(j2, 1000000000));
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static C7176 m10601(DataInput dataInput) {
        return m10600(dataInput.readLong(), dataInput.readInt());
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public static C7176 m10602(long j) {
        return m10599(j, 0);
    }

    @Override // java.lang.Comparable
    public int compareTo(C7176 c7176) {
        C7176 c71762 = c7176;
        int iM10537 = C7158.m10537(this.f20796, c71762.f20796);
        return iM10537 != 0 ? iM10537 : this.f20797 - c71762.f20797;
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof C7176)) {
            return false;
        }
        C7176 c7176 = (C7176) obj;
        return this.f20796 == c7176.f20796 && this.f20797 == c7176.f20797;
    }

    public int hashCode() {
        long j = this.f20796;
        return (this.f20797 * 51) + ((int) (j ^ (j >>> 32)));
    }

    public String toString() {
        if (this == f20795) {
            return "PT0S";
        }
        long j = this.f20796;
        long j2 = j / 3600;
        int i = (int) ((j % 3600) / 60);
        int i2 = (int) (j % 60);
        StringBuilder sb = new StringBuilder(24);
        sb.append("PT");
        if (j2 != 0) {
            sb.append(j2);
            sb.append('H');
        }
        if (i != 0) {
            sb.append(i);
            sb.append('M');
        }
        if (i2 == 0 && this.f20797 == 0 && sb.length() > 2) {
            return sb.toString();
        }
        if (i2 >= 0 || this.f20797 <= 0) {
            sb.append(i2);
        } else if (i2 == -1) {
            sb.append("-0");
        } else {
            sb.append(i2 + 1);
        }
        if (this.f20797 > 0) {
            int length = sb.length();
            if (i2 < 0) {
                sb.append(2000000000 - this.f20797);
            } else {
                sb.append(this.f20797 + 1000000000);
            }
            while (sb.charAt(sb.length() - 1) == '0') {
                sb.setLength(sb.length() - 1);
            }
            sb.setCharAt(length, '.');
        }
        sb.append('S');
        return sb.toString();
    }

    @Override // p463.p484.p485.p489.InterfaceC7274
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public InterfaceC7269 mo10603(InterfaceC7269 interfaceC7269) {
        long j = this.f20796;
        if (j != 0) {
            interfaceC7269 = interfaceC7269.mo10618(j, EnumC7260.SECONDS);
        }
        int i = this.f20797;
        return i != 0 ? interfaceC7269.mo10618(i, EnumC7260.NANOS) : interfaceC7269;
    }
}
