package j2;

/* loaded from: classes.dex */
public final class d1 {

    /* renamed from: a, reason: collision with root package name */
    public static final d1 f23610a = new d1();

    /* loaded from: classes.dex */
    private static final class a implements h2.d0 {

        /* renamed from: p, reason: collision with root package name */
        private final h2.n f23611p;

        /* renamed from: q, reason: collision with root package name */
        private final c f23612q;

        /* renamed from: r, reason: collision with root package name */
        private final d f23613r;

        public a(h2.n nVar, c cVar, d dVar) {
            this.f23611p = nVar;
            this.f23612q = cVar;
            this.f23613r = dVar;
        }

        @Override // h2.n
        public int T(int i10) {
            return this.f23611p.T(i10);
        }

        @Override // h2.n
        public int X(int i10) {
            return this.f23611p.X(i10);
        }

        @Override // h2.d0
        public h2.p0 Y(long j10) {
            if (this.f23613r == d.Width) {
                return new b(this.f23612q == c.Max ? this.f23611p.X(c3.b.k(j10)) : this.f23611p.T(c3.b.k(j10)), c3.b.g(j10) ? c3.b.k(j10) : 32767);
            }
            return new b(c3.b.h(j10) ? c3.b.l(j10) : 32767, this.f23612q == c.Max ? this.f23611p.s(c3.b.l(j10)) : this.f23611p.v0(c3.b.l(j10)));
        }

        @Override // h2.n
        public Object p() {
            return this.f23611p.p();
        }

        @Override // h2.n
        public int s(int i10) {
            return this.f23611p.s(i10);
        }

        @Override // h2.n
        public int v0(int i10) {
            return this.f23611p.v0(i10);
        }
    }

    /* loaded from: classes.dex */
    private static final class b extends h2.p0 {
        public b(int i10, int i11) {
            c1(c3.s.a(i10, i11));
        }

        @Override // h2.p0
        protected void V0(long j10, float f10, dn.l lVar) {
        }

        @Override // h2.h0
        public int u0(h2.a aVar) {
            return Integer.MIN_VALUE;
        }
    }

    /* loaded from: classes.dex */
    private enum c {
        Min,
        Max
    }

    /* loaded from: classes.dex */
    private enum d {
        Width,
        Height
    }

    /* loaded from: classes.dex */
    public interface e {
        h2.f0 h(h2.g0 g0Var, h2.d0 d0Var, long j10);
    }

    private d1() {
    }

    public final int a(e eVar, h2.o oVar, h2.n nVar, int i10) {
        return eVar.h(new h2.r(oVar, oVar.getLayoutDirection()), new a(nVar, c.Max, d.Height), c3.c.b(0, i10, 0, 0, 13, null)).getHeight();
    }

    public final int b(e eVar, h2.o oVar, h2.n nVar, int i10) {
        return eVar.h(new h2.r(oVar, oVar.getLayoutDirection()), new a(nVar, c.Max, d.Width), c3.c.b(0, 0, 0, i10, 7, null)).getWidth();
    }

    public final int c(e eVar, h2.o oVar, h2.n nVar, int i10) {
        return eVar.h(new h2.r(oVar, oVar.getLayoutDirection()), new a(nVar, c.Min, d.Height), c3.c.b(0, i10, 0, 0, 13, null)).getHeight();
    }

    public final int d(e eVar, h2.o oVar, h2.n nVar, int i10) {
        return eVar.h(new h2.r(oVar, oVar.getLayoutDirection()), new a(nVar, c.Min, d.Width), c3.c.b(0, 0, 0, i10, 7, null)).getWidth();
    }
}
