package com.bytedance.sdk.openadsdk.core.qsH.YFl;

import android.content.Context;
import android.util.Pair;
import android.view.View;
import android.view.Window;
import com.bytedance.sdk.openadsdk.utils.GS;
/* loaded from: classes2.dex */
public class YFl {
    public static Pair<Float, Float> YFl(Window window, int i) {
        View decorView = window.getDecorView();
        float[] fArr = {decorView.getWidth() - (decorView.getPaddingLeft() * 2), decorView.getHeight() - (decorView.getPaddingTop() * 2)};
        fArr[0] = GS.AlY(window.getContext(), fArr[0]);
        float AlY = GS.AlY(window.getContext(), fArr[1]);
        fArr[1] = AlY;
        if (fArr[0] < 10.0f || AlY < 10.0f) {
            fArr = YFl(window.getContext(), GS.AlY(window.getContext(), GS.YFl()), i);
        }
        float max = Math.max(fArr[0], fArr[1]);
        float min = Math.min(fArr[0], fArr[1]);
        if (i == 1) {
            fArr[0] = min;
            fArr[1] = max;
        } else {
            fArr[0] = max;
            fArr[1] = min;
        }
        return new Pair<>(Float.valueOf(fArr[0]), Float.valueOf(fArr[1]));
    }

    private static float[] YFl(Context context, int i, int i2) {
        float YFl = YFl(context);
        float Sg = Sg(context);
        if ((i2 == 1) != (YFl > Sg)) {
            float f = YFl + Sg;
            Sg = f - Sg;
            YFl = f - Sg;
        }
        if (i2 == 1) {
            YFl -= i;
        } else {
            Sg -= i;
        }
        return new float[]{Sg, YFl};
    }

    public static float YFl(Context context) {
        return GS.AlY(context, GS.NjR(context));
    }

    public static float Sg(Context context) {
        return GS.AlY(context, GS.nc(context));
    }
}
