package v0;

import android.R;
import android.graphics.Outline;
import android.view.ContextThemeWrapper;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewOutlineProvider;
import android.view.Window;
import androidx.compose.ui.platform.e3;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.firebase.crashlytics.internal.metadata.UserMetadata;
import java.util.UUID;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public final class s0 extends androidx.activity.l implements e3 {

    /* renamed from: s, reason: collision with root package name */
    private dn.a f38408s;

    /* renamed from: t, reason: collision with root package name */
    private u0 f38409t;

    /* renamed from: u, reason: collision with root package name */
    private final View f38410u;

    /* renamed from: v, reason: collision with root package name */
    private final r0 f38411v;

    /* renamed from: w, reason: collision with root package name */
    private final float f38412w;

    /* loaded from: classes.dex */
    public static final class a extends ViewOutlineProvider {
        a() {
        }

        @Override // android.view.ViewOutlineProvider
        public void getOutline(View view, Outline outline) {
            outline.setRect(0, 0, view.getWidth(), view.getHeight());
            outline.setAlpha(BitmapDescriptorFactory.HUE_RED);
        }
    }

    /* loaded from: classes.dex */
    static final class b extends kotlin.jvm.internal.v implements dn.l {
        b() {
            super(1);
        }

        public final void a(androidx.activity.p pVar) {
            if (s0.this.f38409t.b()) {
                s0.this.f38408s.invoke();
            }
        }

        @Override // dn.l
        public /* bridge */ /* synthetic */ Object invoke(Object obj) {
            a((androidx.activity.p) obj);
            return rm.n0.f34904a;
        }
    }

    /* loaded from: classes.dex */
    public /* synthetic */ class c {

        /* renamed from: a, reason: collision with root package name */
        public static final /* synthetic */ int[] f38414a;

        static {
            int[] iArr = new int[c3.t.values().length];
            try {
                iArr[c3.t.Ltr.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                iArr[c3.t.Rtl.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            f38414a = iArr;
        }
    }

    public s0(dn.a aVar, u0 u0Var, View view, c3.t tVar, c3.d dVar, UUID uuid, y.a aVar2, tp.m0 m0Var, boolean z10) {
        super(new ContextThemeWrapper(view.getContext(), c1.f37940a), 0, 2, null);
        this.f38408s = aVar;
        this.f38409t = u0Var;
        this.f38410u = view;
        float t10 = c3.h.t(8);
        this.f38412w = t10;
        Window window = getWindow();
        if (window == null) {
            throw new IllegalStateException("Dialog has no window".toString());
        }
        window.requestFeature(1);
        window.setBackgroundDrawableResource(R.color.transparent);
        androidx.core.view.f1.b(window, false);
        r0 r0Var = new r0(getContext(), window, this.f38409t.b(), this.f38408s, aVar2, m0Var);
        r0Var.setTag(l1.m.H, "Dialog:" + uuid);
        r0Var.setClipChildren(false);
        r0Var.setElevation(dVar.L0(t10));
        r0Var.setOutlineProvider(new a());
        this.f38411v = r0Var;
        setContentView(r0Var);
        androidx.lifecycle.f1.b(r0Var, androidx.lifecycle.f1.a(view));
        androidx.lifecycle.g1.b(r0Var, androidx.lifecycle.g1.a(view));
        i5.g.b(r0Var, i5.g.a(view));
        k(this.f38408s, this.f38409t, tVar);
        androidx.core.view.i1 a10 = androidx.core.view.f1.a(window, window.getDecorView());
        a10.b(!z10);
        a10.a(!z10);
        androidx.activity.s.b(getOnBackPressedDispatcher(), this, false, new b(), 2, null);
    }

    private final void i(c3.t tVar) {
        r0 r0Var = this.f38411v;
        int i10 = c.f38414a[tVar.ordinal()];
        int i11 = 1;
        if (i10 == 1) {
            i11 = 0;
        } else if (i10 != 2) {
            throw new rm.t();
        }
        r0Var.setLayoutDirection(i11);
    }

    private final void j(androidx.compose.ui.window.s sVar) {
        boolean f10;
        f10 = v0.f(sVar, v0.e(this.f38410u));
        Window window = getWindow();
        kotlin.jvm.internal.t.d(window);
        window.setFlags(f10 ? 8192 : -8193, UserMetadata.MAX_INTERNAL_KEY_SIZE);
    }

    @Override // android.app.Dialog, android.content.DialogInterface
    public void cancel() {
    }

    public final void g() {
        this.f38411v.e();
    }

    public final void h(y0.r rVar, dn.p pVar) {
        this.f38411v.m(rVar, pVar);
    }

    public final void k(dn.a aVar, u0 u0Var, c3.t tVar) {
        this.f38408s = aVar;
        this.f38409t = u0Var;
        j(u0Var.a());
        i(tVar);
        Window window = getWindow();
        if (window != null) {
            window.setLayout(-1, -1);
        }
        Window window2 = getWindow();
        if (window2 != null) {
            window2.setSoftInputMode(48);
        }
    }

    @Override // android.app.Dialog
    public boolean onTouchEvent(MotionEvent motionEvent) {
        boolean onTouchEvent = super.onTouchEvent(motionEvent);
        if (onTouchEvent) {
            this.f38408s.invoke();
        }
        return onTouchEvent;
    }
}
