package h0;

import com.google.android.gms.maps.model.BitmapDescriptorFactory;

/* loaded from: classes.dex */
final class j implements b0.d {

    /* renamed from: b, reason: collision with root package name */
    private final c0 f20542b;

    /* renamed from: c, reason: collision with root package name */
    private final b0.d f20543c;

    /* renamed from: d, reason: collision with root package name */
    private final y.i f20544d;

    public j(c0 c0Var, b0.d dVar) {
        this.f20542b = c0Var;
        this.f20543c = dVar;
        this.f20544d = dVar.b();
    }

    private final float c(float f10) {
        float z10 = this.f20542b.z() * (-1);
        while (f10 > BitmapDescriptorFactory.HUE_RED && z10 < f10) {
            z10 += this.f20542b.H();
        }
        while (f10 < BitmapDescriptorFactory.HUE_RED && z10 > f10) {
            z10 -= this.f20542b.H();
        }
        return z10;
    }

    @Override // b0.d
    public float a(float f10, float f11, float f12) {
        float j10;
        float a10 = this.f20543c.a(f10, f11, f12);
        if (!(a10 == BitmapDescriptorFactory.HUE_RED)) {
            return c(a10);
        }
        if (this.f20542b.z() == 0) {
            return BitmapDescriptorFactory.HUE_RED;
        }
        float z10 = this.f20542b.z() * (-1.0f);
        if (this.f20542b.B()) {
            z10 += this.f20542b.H();
        }
        j10 = jn.o.j(z10, -f12, f12);
        return j10;
    }

    @Override // b0.d
    public y.i b() {
        return this.f20544d;
    }
}
