package o;

import android.R;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Region;
import android.os.Build;
import android.util.Log;
import android.view.View;
import android.view.autofill.AutofillManager;
import android.view.inputmethod.InputMethodManager;
import androidx.profileinstaller.ProfileInstallReceiver;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.Api;
import com.google.android.material.behavior.SwipeDismissBehavior;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.WeakHashMap;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public class WT implements InterfaceC0912cZ, InterfaceC2956xx, InterfaceC2543tg, S0, HT {
    public final /* synthetic */ int l;
    public Object m;

    public /* synthetic */ WT(int i, Object obj) {
        this.l = i;
        this.m = obj;
    }

    @Override // o.S0
    public boolean a(View view) {
        SwipeDismissBehavior swipeDismissBehavior = (SwipeDismissBehavior) this.m;
        if (!swipeDismissBehavior.r(view)) {
            return false;
        }
        WeakHashMap weakHashMap = Oj0.a;
        boolean z = view.getLayoutDirection() == 1;
        int i = swipeDismissBehavior.d;
        view.offsetLeftAndRight((!(i == 0 && z) && (i != 1 || z)) ? view.getWidth() : -view.getWidth());
        view.setAlpha(0.0f);
        return true;
    }

    public C2581u00 b() {
        C1140es c1140esD;
        C0949cs c0949cs = (C0949cs) this.m;
        C1332gs c1332gs = (C1332gs) c0949cs.d;
        synchronized (c1332gs) {
            c0949cs.a(true);
            c1140esD = c1332gs.d(((C1044ds) c0949cs.b).a);
        }
        if (c1140esD != null) {
            return new C2581u00(c1140esD);
        }
        return null;
    }

    public InterfaceC1629jz c(int i) {
        switch (this.l) {
            case 27:
                return ((C1724kz[]) this.m)[i];
            case 28:
                return (C1724kz) this.m;
            default:
                return (InterfaceC1629jz) this.m;
        }
    }

    public void d() {
        View view = (View) this.m;
        if (view != null) {
            ((InputMethodManager) view.getContext().getSystemService("input_method")).hideSoftInputFromWindow(view.getWindowToken(), 0);
        }
    }

    public void e(View view, int i, boolean z) {
        if (Build.VERSION.SDK_INT >= 27) {
            ((AutofillManager) this.m).notifyViewVisibilityChanged(view, i, z);
        }
    }

    @Override // o.InterfaceC0912cZ
    public void f(int i, Object obj) {
        if (i == 6 || i == 7 || i == 8) {
        }
        ((ProfileInstallReceiver) this.m).setResultCode(i);
    }

    public C2513tI g(C1390hY c1390hY, C2207q3 c2207q3) {
        int i;
        long jG;
        long j;
        boolean z;
        UM um = (UM) this.m;
        UM um2 = new UM(((List) c1390hY.m).size());
        List list = (List) c1390hY.m;
        int size = list.size();
        int i2 = 0;
        while (i2 < size) {
            KX kx = (KX) list.get(i2);
            long j2 = kx.a;
            JX jx = (JX) um.b(j2);
            if (jx == null) {
                i = i2;
                j = kx.b;
                jG = kx.d;
                z = false;
            } else {
                long j3 = jx.a;
                boolean z2 = jx.c;
                i = i2;
                jG = c2207q3.G(jx.b);
                j = j3;
                z = z2;
            }
            long j4 = kx.a;
            List list2 = list;
            int i3 = size;
            um2.e(j4, new IX(j4, kx.b, kx.d, kx.e, kx.f, j, jG, z, kx.g, kx.i, kx.j, kx.k));
            boolean z3 = kx.e;
            if (z3) {
                um.e(j2, new JX(kx.b, kx.c, z3));
            } else {
                um.f(j2);
            }
            i2 = i + 1;
            list = list2;
            size = i3;
        }
        return new C2513tI(um2, c1390hY);
    }

    @Override // o.CZ
    public Object get() {
        return new C1931n70((C2692v80) ((BZ) this.m).get());
    }

    public void h() {
        View viewFindViewById;
        View view = (View) this.m;
        if (view == null) {
            return;
        }
        if (view.isInEditMode() || view.onCheckIsTextEditor()) {
            view.requestFocus();
            viewFindViewById = view;
        } else {
            viewFindViewById = view.getRootView().findFocus();
        }
        if (viewFindViewById == null) {
            viewFindViewById = view.getRootView().findViewById(R.id.content);
        }
        if (viewFindViewById == null || !viewFindViewById.hasWindowFocus()) {
            return;
        }
        viewFindViewById.post(new N90(viewFindViewById, 0));
    }

    @Override // o.InterfaceC2543tg
    public void onCancel() {
        ((androidx.fragment.app.x) this.m).a();
    }

    @Override // o.HT
    public void onComplete(Pc0 pc0) {
        Exception excE = pc0.e();
        if (excE != null) {
            ((C2448sg) this.m).resumeWith(new H20(excE));
        } else if (((Hw0) pc0).d) {
            ((C2448sg) this.m).k(null);
        } else {
            ((C2448sg) this.m).resumeWith(pc0.f());
        }
    }

    public /* synthetic */ WT(int i, boolean z) {
        this.l = i;
    }

    public WT(int i) {
        Object bp;
        this.l = i;
        switch (i) {
            case 3:
                this.m = new UM((Object) null);
                break;
            case ConnectionResult.SERVICE_INVALID /* 9 */:
                this.m = new LinkedHashSet();
                break;
            case 10:
                this.m = AbstractC0752ap.X(Boolean.FALSE);
                break;
            case ConnectionResult.LICENSE_CHECK_FAILED /* 11 */:
                this.m = new Region();
                break;
            default:
                if (Build.VERSION.SDK_INT >= 28) {
                    bp = new C2616uQ(4);
                } else {
                    bp = new BP(5);
                }
                this.m = bp;
                break;
        }
    }

    public WT(InterfaceC2281qr interfaceC2281qr) {
        this.l = 18;
        float f = AbstractC1010da0.a;
        C1248fz c1248fz = new C1248fz();
        c1248fz.a = f;
        float fE = interfaceC2281qr.e();
        float f2 = AbstractC1344gz.a;
        c1248fz.b = fE * 386.0878f * 160.0f * 0.84f;
        this.m = c1248fz;
    }

    public WT(View view) {
        this.l = 16;
        if (Build.VERSION.SDK_INT >= 30) {
            P90 p90 = new P90(15, view);
            p90.n = view;
            this.m = p90;
            return;
        }
        this.m = new WT(15, view);
    }

    public WT(Context context) {
        boolean zIsEmpty;
        this.l = 19;
        SharedPreferences sharedPreferences = context.getSharedPreferences("com.google.android.gms.appid", 0);
        this.m = sharedPreferences;
        File file = new File(context.getNoBackupFilesDir(), "com.google.android.gms.appid-no-backup");
        if (file.exists()) {
            return;
        }
        try {
            if (file.createNewFile()) {
                synchronized (this) {
                    zIsEmpty = sharedPreferences.getAll().isEmpty();
                }
                if (zIsEmpty) {
                    return;
                }
                synchronized (this) {
                    sharedPreferences.edit().clear().commit();
                }
            }
        } catch (IOException e) {
            if (Log.isLoggable("FirebaseMessaging", 3)) {
                e.getMessage();
            }
        }
    }

    public WT(long[] jArr) {
        MQ mq;
        this.l = 14;
        if (jArr != null) {
            long[] jArrCopyOf = Arrays.copyOf(jArr, jArr.length);
            mq = new MQ(jArrCopyOf.length);
            int i = mq.b;
            if (i >= 0) {
                if (jArrCopyOf.length != 0) {
                    int length = jArrCopyOf.length + i;
                    long[] jArr2 = mq.a;
                    if (jArr2.length < length) {
                        mq.a = Arrays.copyOf(jArr2, Math.max(length, (jArr2.length * 3) / 2));
                    }
                    long[] jArr3 = mq.a;
                    int i2 = mq.b;
                    if (i != i2) {
                        AbstractC2219q9.K(jArr3, jArr3, jArrCopyOf.length + i, i, i2);
                    }
                    System.arraycopy(jArrCopyOf, 0, jArr3, i, jArrCopyOf.length);
                    mq.b += jArrCopyOf.length;
                }
            } else {
                AbstractC2841wm0.J("");
                throw null;
            }
        } else {
            mq = new MQ(16);
        }
        this.m = mq;
    }

    public WT(ThreadFactoryC2169pi0 threadFactoryC2169pi0) {
        this.l = 21;
        this.m = new ThreadPoolExecutor(0, Api.BaseClientBuilder.API_PRIORITY_OTHER, 60L, TimeUnit.SECONDS, new SynchronousQueue(), threadFactoryC2169pi0);
    }

    public WT(float f, float f2, Y6 y6) {
        this.l = 27;
        int iB = y6.b();
        C1724kz[] c1724kzArr = new C1724kz[iB];
        for (int i = 0; i < iB; i++) {
            c1724kzArr[i] = new C1724kz(f, f2, y6.a(i));
        }
        this.m = c1724kzArr;
    }

    public WT(float f, float f2) {
        this.l = 28;
        this.m = new C1724kz(f, f2, 0.01f);
    }
}
