package wp;

import xp.m;

/* loaded from: classes3.dex */
public abstract /* synthetic */ class k {
    public static final e a(e eVar, int i10, vp.a aVar) {
        int i11;
        vp.a aVar2;
        boolean z10 = true;
        if (!(i10 >= 0 || i10 == -2 || i10 == -1)) {
            throw new IllegalArgumentException(("Buffer size should be non-negative, BUFFERED, or CONFLATED, but was " + i10).toString());
        }
        if (i10 == -1 && aVar != vp.a.SUSPEND) {
            z10 = false;
        }
        if (!z10) {
            throw new IllegalArgumentException("CONFLATED capacity cannot be used with non-default onBufferOverflow".toString());
        }
        if (i10 == -1) {
            aVar2 = vp.a.DROP_OLDEST;
            i11 = 0;
        } else {
            i11 = i10;
            aVar2 = aVar;
        }
        return eVar instanceof xp.m ? m.a.a((xp.m) eVar, null, i11, aVar2, 1, null) : new xp.h(eVar, null, i11, aVar2, 2, null);
    }

    public static /* synthetic */ e b(e eVar, int i10, vp.a aVar, int i11, Object obj) {
        if ((i11 & 1) != 0) {
            i10 = -2;
        }
        if ((i11 & 2) != 0) {
            aVar = vp.a.SUSPEND;
        }
        return g.c(eVar, i10, aVar);
    }
}
