导航菜单

页面标题

页面副标题

Tasker v6.6.3 - a.java 源代码

正在查看: Tasker v6.6.3 应用的 a.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.joaomgcd.taskerm.dialog;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.app.NotificationChannel;
import android.app.TimePickerDialog;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.UriPermission;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.Bitmap;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.net.Uri;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.os.Message;
import android.widget.DatePicker;
import android.widget.TimePicker;
import com.joaomgcd.oldtaskercompat.matter.MatterDevice;
import com.joaomgcd.oldtaskercompat.matter.MatterDevices;
import com.joaomgcd.taskerm.action.system.KeyboardApps;
import com.joaomgcd.taskerm.contacts.ContactData;
import com.joaomgcd.taskerm.dialog.a;
import com.joaomgcd.taskerm.dialog.b;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityPickShortcut;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityRequestCallScreeningAccess;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityRequestDigitalAssistantPermission;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityRequestDoNotDisturbAccess;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityRequestManageExternalStorageAccess;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityRequestMissingPermissions;
import com.joaomgcd.taskerm.genericaction.GenericActionActivityRequestNotificationAccess;
import com.joaomgcd.taskerm.genericaction.GenericActionActivitySelectApp;
import com.joaomgcd.taskerm.genericaction.GenericActionPickContact;
import com.joaomgcd.taskerm.genericaction.GenericActionPickContactWithMimeType;
import com.joaomgcd.taskerm.genericaction.i;
import com.joaomgcd.taskerm.navigationbar.IconProvider;
import com.joaomgcd.taskerm.settings.ComponentNameList;
import com.joaomgcd.taskerm.settings.d1;
import com.joaomgcd.taskerm.util.AppBasic;
import com.joaomgcd.taskerm.util.ExtensionsContextKt;
import com.joaomgcd.taskerm.util.GenericActionActivityGrantUriPermission;
import com.joaomgcd.taskerm.util.ac;
import com.joaomgcd.taskerm.util.b7;
import com.joaomgcd.taskerm.util.bi;
import com.joaomgcd.taskerm.util.g0;
import com.joaomgcd.taskerm.util.h0;
import com.joaomgcd.taskerm.util.j3;
import com.joaomgcd.taskerm.util.l7;
import com.joaomgcd.taskerm.util.md;
import com.joaomgcd.taskerm.util.n0;
import com.joaomgcd.taskerm.util.oe;
import com.joaomgcd.taskerm.util.pe;
import com.joaomgcd.taskerm.util.ph;
import com.joaomgcd.taskerm.util.r8;
import com.joaomgcd.taskerm.util.s8;
import com.joaomgcd.taskerm.util.se;
import com.joaomgcd.taskerm.util.te;
import com.joaomgcd.taskerm.util.ue;
import com.joaomgcd.taskerm.util.vc;
import com.joaomgcd.taskerm.util.ve;
import com.joaomgcd.taskerm.util.we;
import df.f8;
import df.g8;
import df.i8;
import df.j8;
import df.o1;
import df.p1;
import df.r;
import df.s7;
import df.t7;
import df.x0;
import df.x7;
import ik.l;
import java.io.File;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import je.z3;
import jk.f0;
import jk.h;
import jk.j0;
import jk.p;
import kotlin.Pair;
import kotlin.collections.n;
import kotlin.collections.t;
import ne.z;
import net.dinglisch.android.taskerm.ActionEdit;
import net.dinglisch.android.taskerm.Expr;
import net.dinglisch.android.taskerm.FileSelect;
import net.dinglisch.android.taskerm.Kid;
import net.dinglisch.android.taskerm.TextBoxDialogFragment;
import net.dinglisch.android.taskerm.a1;
import net.dinglisch.android.taskerm.c5;
import net.dinglisch.android.taskerm.d4;
import net.dinglisch.android.taskerm.ep;
import net.dinglisch.android.taskerm.f5;
import net.dinglisch.android.taskerm.fn;
import net.dinglisch.android.taskerm.fo;
import net.dinglisch.android.taskerm.fp;
import net.dinglisch.android.taskerm.g;
import net.dinglisch.android.taskerm.go;
import net.dinglisch.android.taskerm.gr;
import net.dinglisch.android.taskerm.io;
import net.dinglisch.android.taskerm.ji;
import net.dinglisch.android.taskerm.mh;
import net.dinglisch.android.taskerm.mj;
import net.dinglisch.android.taskerm.od;
import net.dinglisch.android.taskerm.oh;
import net.dinglisch.android.taskerm.p5;
import net.dinglisch.android.taskerm.pi;
import net.dinglisch.android.taskerm.pp;
import net.dinglisch.android.taskerm.q1;
import net.dinglisch.android.taskerm.r1;
import net.dinglisch.android.taskerm.ud;
import net.dinglisch.android.taskerm.ug;
import net.dinglisch.android.taskerm.xg;
import pg.a2;
import pg.n2;
import sk.q;
import ti.s;
import ti.u;
import ti.v;
import vj.e0;
import xf.j7;
import xg.e2;
import zg.b3;
import zg.c3;
import zg.f1;
import zg.g2;
import zg.h1;
import zg.i1;

public final class a {
    private static b3 a;

    @bk.f(c = "com.joaomgcd.taskerm.dialog.DialogMessageKt", f = "DialogMessage.kt", l = {1714, 1716, 1717, 1726, 1730, 1733}, m = "dialogPickRemoteDevice")
    static final class C0071a extends bk.d {
        Object s;
        Object t;
        Object u;
        Object v;
        Object w;
        boolean x;
        Object y;
        int z;

        C0071a(zj.e<? super C0071a> eVar) {
            super(eVar);
        }

        public final Object t(Object obj) {
            this.y = obj;
            this.z |= Integer.MIN_VALUE;
            return a.i5(null, this);
        }
    }

    @bk.f(c = "com.joaomgcd.taskerm.dialog.DialogMessageKt", f = "DialogMessage.kt", l = {1763}, m = "dialogSelectFileSuspend")
    static final class b extends bk.d {
        Object s;
        Object t;
        Object u;
        Object v;
        int w;

        b(zj.e<? super b> eVar) {
            super(eVar);
        }

        public final Object t(Object obj) {
            this.v = obj;
            this.w |= Integer.MIN_VALUE;
            return a.D6(null, null, null, this);
        }
    }

    @bk.f(c = "com.joaomgcd.taskerm.dialog.DialogMessageKt", f = "DialogMessage.kt", l = {1759}, m = "dialogSelectImageSuspend")
    static final class c extends bk.d {
        Object s;
        Object t;
        Object u;
        int v;

        c(zj.e<? super c> eVar) {
            super(eVar);
        }

        public final Object t(Object obj) {
            this.u = obj;
            this.v |= Integer.MIN_VALUE;
            return a.K6(null, null, this);
        }
    }

    public static final class d implements j7 {
        private final Context a;
        private final String b;

        public d(Context context, String str) {
            p.i(context, "context");
            p.i(str, "id");
            this.a = context;
            this.b = str;
        }

        public String getId() {
            return this.b;
        }

        public String toString() {
            return vc.V(getId(), this.a) + " (" + q.z0(getId(), "android.permission.") + ")";
        }
    }

    public static final class e implements SensorEventListener {
        final f0 i;
        final j0<float[]> q;
        final j0<float[]> r;
        final j0<r> s;

        e(f0 f0Var, j0<float[]> j0Var, j0<float[]> j0Var2, j0<r> j0Var3) {
            this.i = f0Var;
            this.q = j0Var;
            this.r = j0Var2;
            this.s = j0Var3;
        }

        @Override
        public void onAccuracyChanged(Sensor sensor, int i) {
        }

        @Override
        public void onSensorChanged(SensorEvent sensorEvent) {
            float[] fArr;
            String str;
            float[] fArr2;
            if (sensorEvent == null || (fArr2 = sensorEvent.values) == null) {
                fArr = null;
            } else {
                ArrayList arrayList = new ArrayList();
                int length = fArr2.length;
                for (int i = 0; i < length; i++) {
                    float f = fArr2[i];
                    if (!(f == 0.0f)) {
                        arrayList.add(Float.valueOf(f));
                    }
                }
                fArr = t.M0(arrayList);
            }
            float[] fArr3 = fArr;
            if (this.i.i) {
                this.q.i = fArr3;
            } else {
                this.r.i = fArr3;
            }
            r rVar = (r) this.s.i;
            if (fArr3 == null || (str = n.k0(fArr3, "\n", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (l) null, 62, (Object) null)) == null) {
                str = "No Value";
            }
            rVar.c(str);
        }
    }

    public static final class f implements SensorEventListener {
        final ArrayList<float[]> i;
        final int q;
        final j0<r> r;

        f(ArrayList<float[]> arrayList, int i, j0<r> j0Var) {
            this.i = arrayList;
            this.q = i;
            this.r = j0Var;
        }

        public static final CharSequence b(float[] fArr) {
            p.i(fArr, "it");
            return n.k0(fArr, ",", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (l) null, 62, (Object) null);
        }

        @Override
        public void onAccuracyChanged(Sensor sensor, int i) {
        }

        @Override
        public void onSensorChanged(SensorEvent sensorEvent) {
            float[] fArr;
            Object obj;
            if (sensorEvent == null || (fArr = sensorEvent.values) == null) {
                return;
            }
            float[] copyOf = Arrays.copyOf(fArr, fArr.length);
            p.h(copyOf, "copyOf(...)");
            if (copyOf == null) {
                return;
            }
            Iterator<T> it = this.i.iterator();
            while (true) {
                if (!it.hasNext()) {
                    obj = null;
                    break;
                } else {
                    obj = it.next();
                    if (Arrays.equals((float[]) obj, copyOf)) {
                        break;
                    }
                }
            }
            if (((float[]) obj) != null) {
                return;
            }
            this.i.add(copyOf);
            if (this.i.size() > this.q) {
                ((r) this.r.i).e();
            } else {
                ((r) this.r.i).c(t.n0(this.i, " or ", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, new l() {
                    public final Object invoke(Object obj2) {
                        CharSequence b;
                        b = a.f.b((float[]) obj2);
                        return b;
                    }
                }, 30, (Object) null));
            }
        }
    }

    public static final ti.r<String> A2(Activity activity, boolean z) {
        p.i(activity, "activity");
        return u2(activity, c5.l.q, z);
    }

    public static final ti.r<pe> A3(final Activity activity, final se seVar) {
        p.i(activity, "activity");
        p.i(seVar, "error");
        if (ac.a.F1(ac.f, activity, 0, 2, (Object) null).i0()) {
            ti.r<pe> w = ti.r.w(new ue());
            p.h(w, "just(...)");
            return w;
        }
        ti.r<p1> w72 = w7(new r(activity, 2131887507, b7.j6(2131887255, activity, new Object[0]), 2131886894, 2131886892, 0, false, 0, (String) null, 0, (Integer) null, 2016, (h) null));
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                ti.v C3;
                C3 = com.joaomgcd.taskerm.dialog.a.C3(activity, seVar, (p1) obj);
                return C3;
            }
        };
        ti.r<pe> t = w72.t(new yi.e() {
            public final Object a(Object obj) {
                ti.v D3;
                D3 = com.joaomgcd.taskerm.dialog.a.D3(lVar, obj);
                return D3;
            }
        });
        p.h(t, "flatMap(...)");
        return t;
    }

    public static final o1 A4(BluetoothDevice bluetoothDevice) {
        p.i(bluetoothDevice, "it");
        return new o1(b7.N2(bluetoothDevice), null, false, 6, null);
    }

    public static ti.r A5(Activity activity, g8 g8Var, String str, String str2, int i, Object obj) {
        if ((i & 2) != 0) {
            g8Var = null;
        }
        if ((i & 4) != 0) {
            str = null;
        }
        if ((i & 8) != 0) {
            str2 = null;
        }
        return z5(activity, g8Var, str, str2);
    }

    public static final ti.r<String[]> A6(final Context context, final String str, final boolean z, final String str2, final boolean z2, final boolean z3, final boolean z4, final Long l) {
        p.i(context, "context");
        p.i(str, "type");
        return e2.y1(new ik.a() {
            public final Object e() {
                String[] C6;
                C6 = com.joaomgcd.taskerm.dialog.a.C6(context, z2, z, str2, l, z3, z4, str);
                return C6;
            }
        });
    }

    public static final ti.r<p1> A7(Activity activity, String str) {
        p.i(activity, "activity");
        p.i(str, "text");
        return q4(activity, 2131890883, str, 0, 0, null, 56, null);
    }

    public static ti.r B2(Activity activity, boolean z, int i, Object obj) {
        if ((i & 2) != 0) {
            z = false;
        }
        return A2(activity, z);
    }

    public static ti.r B3(Activity activity, se seVar, int i, Object obj) {
        if ((i & 2) != 0) {
            seVar = ac.f.T(activity);
        }
        return A3(activity, seVar);
    }

    public static final ti.r<ComponentNameList> B4(final Activity activity, final List<ComponentName> list) {
        p.i(activity, "context");
        p.i(list, "alreadySelected");
        if (ExtensionsContextKt.c1(activity)) {
            return e2.y1(new ik.a() {
                public final Object e() {
                    ComponentNameList E4;
                    E4 = com.joaomgcd.taskerm.dialog.a.E4(activity, list);
                    return E4;
                }
            });
        }
        ti.r h6 = h6(activity, null, null, 0, false, false, false, 126, null);
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                ComponentNameList C4;
                C4 = com.joaomgcd.taskerm.dialog.a.C4((p1) obj);
                return C4;
            }
        };
        ti.r<ComponentNameList> x = h6.x(new yi.e() {
            public final Object a(Object obj) {
                ComponentNameList D4;
                D4 = com.joaomgcd.taskerm.dialog.a.D4(lVar, obj);
                return D4;
            }
        });
        p.h(x, "map(...)");
        return x;
    }

    public static final e0 B5(sj.d dVar, TimePicker timePicker, int i, int i2) {
        p.i(timePicker, "view");
        dVar.b(new g8(i, i2));
        return e0.a;
    }

    public static ti.r B6(Context context, String str, boolean z, String str2, boolean z2, boolean z3, boolean z4, Long l, int i, Object obj) {
        if ((i & 2) != 0) {
            str = "*/*";
        }
        return A6(context, str, (i & 4) != 0 ? false : z, (i & 8) != 0 ? null : str2, (i & 16) == 0 ? z2 : false, (i & 32) != 0 ? true : z3, (i & 64) != 0 ? true : z4, (i & 128) == 0 ? l : null);
    }

    public static final ti.r<p1> B7(final Activity activity, int i, final String str) {
        p.i(activity, "activity");
        p.i(str, "learnMoreUrl");
        ti.r p4 = p4(activity, 2131890883, i, 2131888381, 0, null, 48, null);
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                vj.e0 C7;
                C7 = com.joaomgcd.taskerm.dialog.a.C7(activity, str, (p1) obj);
                return C7;
            }
        };
        ti.r<p1> q = p4.q(new yi.d() {
            public final void accept(Object obj) {
                com.joaomgcd.taskerm.dialog.a.D7(lVar, obj);
            }
        });
        p.h(q, "doOnSuccess(...)");
        return q;
    }

    public static final ti.r<String> C2(Activity activity, boolean z) {
        p.i(activity, "activity");
        return u2(activity, c5.l.r, z);
    }

    public static final v C3(Activity activity, se seVar, p1 p1Var) {
        p.i(p1Var, "it");
        if (p1Var.o()) {
            return new GenericActionActivityRequestManageExternalStorageAccess().run(activity);
        }
        ti.r w = ti.r.w(seVar);
        p.f(w);
        return w;
    }

    public static final ComponentNameList C4(p1 p1Var) {
        p.i(p1Var, "it");
        return new ComponentNameList();
    }

    public static final e0 C5(Activity activity, final ik.q qVar, g8 g8Var, Calendar calendar, String str, String str2, final sj.d dVar) {
        TimePickerDialog timePickerDialog = new TimePickerDialog(activity, new TimePickerDialog.OnTimeSetListener() {
            @Override
            public final void onTimeSet(TimePicker timePicker, int i, int i2) {
                com.joaomgcd.taskerm.dialog.a.D5(qVar, timePicker, i, i2);
            }
        }, g8Var != null ? g8Var.a() : calendar.get(11), g8Var != null ? g8Var.b() : calendar.get(12), true);
        if (l7.x0(str)) {
            timePickerDialog.setTitle(str);
        }
        if (l7.x0(str2)) {
            timePickerDialog.setMessage(str2);
        }
        timePickerDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
            @Override
            public final void onCancel(DialogInterface dialogInterface) {
                com.joaomgcd.taskerm.dialog.a.E5(dVar, dialogInterface);
            }
        });
        timePickerDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public final void onDismiss(DialogInterface dialogInterface) {
                com.joaomgcd.taskerm.dialog.a.F5(dVar, dialogInterface);
            }
        });
        timePickerDialog.show();
        return e0.a;
    }

    public static final String[] C6(Context context, boolean z, boolean z2, String str, Long l, boolean z3, boolean z4, String str2) {
        Intent intent;
        ti.r P5;
        if ((context instanceof Activity) && ((Boolean) ac.a.x1(ac.f, (Activity) context, 0, 2, (Object) null).f()).booleanValue()) {
            throw new RuntimeException("No file read permissions");
        }
        if (!z || z2) {
            Intent intent2 = new Intent("android.intent.action.OPEN_DOCUMENT");
            intent2.setType(str2);
            intent2.putExtra("android.intent.extra.ALLOW_MULTIPLE", z2);
            intent2.putExtra("android.provider.extra.INITIAL_URI", l7.D(str));
            intent2.putExtra("android.intent.extra.LOCAL_ONLY", true);
            intent = intent2;
        } else {
            intent = FileSelect.u0(context, (String) null, str, FileSelect.e.i, (String) null, true, true);
        }
        Pair pair = z ? null : new Pair(2131889432, 2131889433);
        if (z) {
            p.f(intent);
            P5 = b7.L5(intent, context, pair != null ? (Integer) pair.getFirst() : null, pair != null ? (Integer) pair.getSecond() : null, l);
        } else {
            p.f(intent);
            P5 = b7.P5(intent, context, pair != null ? (Integer) pair.getFirst() : null, pair != null ? (Integer) pair.getSecond() : null, l);
        }
        return (String[]) ph.R((Intent) P5.f(), context, z, z3, z4).toArray(new String[0]);
    }

    public static final e0 C7(Activity activity, String str, p1 p1Var) {
        if (!p1Var.k()) {
            return e0.a;
        }
        ExtensionsContextKt.e0(activity, str, false, false, true, 6, (Object) null);
        return e0.a;
    }

    public static ti.r D2(Activity activity, boolean z, int i, Object obj) {
        if ((i & 2) != 0) {
            z = false;
        }
        return C2(activity, z);
    }

    public static final v D3(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    public static final ComponentNameList D4(l lVar, Object obj) {
        p.i(obj, "p0");
        return (ComponentNameList) lVar.invoke(obj);
    }

    public static final void D5(ik.q qVar, TimePicker timePicker, int i, int i2) {
        qVar.g(timePicker, Integer.valueOf(i), Integer.valueOf(i2));
    }

    public static final java.lang.Object D6(android.app.Activity r15, java.lang.String r16, java.lang.String r17, zj.e<? super java.lang.String> r18) {
        throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.taskerm.dialog.a.D6(android.app.Activity, java.lang.String, java.lang.String, zj.e):java.lang.Object");
    }

    public static final void D7(l lVar, Object obj) {
        lVar.invoke(obj);
    }

    public static final ti.r<p1> E2(Activity activity, int i, int i2, int i3, boolean z) {
        p.i(activity, "activity");
        return w7(new r(activity, i, i2, -1, 2131886870, i3, z, 0, (String) null, 0, (Integer) null, 1920, (h) null));
    }

    public static final ti.r<pe> E3(Activity activity) {
        p.i(activity, "activity");
        return G3(activity, null, 2, null);
    }

    public static final ComponentNameList E4(Activity activity, final List list) {
        List c2 = ((i8) x0.E(new df.n(activity, b7.a6(2131886231, activity), ExtensionsContextKt.r0(activity), false, new l() {
            public final Object invoke(Object obj) {
                o1 F4;
                F4 = com.joaomgcd.taskerm.dialog.a.F4(list, (com.joaomgcd.taskerm.util.d) obj);
                return F4;
            }
        }, null, null, null, null, null, null, null, null, null, null, null, 65512, null)).f()).c();
        ArrayList arrayList = new ArrayList(t.w(c2, 10));
        Iterator it = c2.iterator();
        while (it.hasNext()) {
            arrayList.add(((com.joaomgcd.taskerm.util.d) it.next()).h());
        }
        return new ComponentNameList(arrayList);
    }

    public static final void E5(sj.d dVar, DialogInterface dialogInterface) {
        e2.i2(dVar, new RuntimeException("Cancelled"));
    }

    public static Object E6(Activity activity, String str, String str2, zj.e eVar, int i, Object obj) {
        if ((i & 2) != 0) {
            str = null;
        }
        if ((i & 4) != 0) {
            str2 = "*/*";
        }
        return D6(activity, str, str2, eVar);
    }

    public static final ti.r<p1> E7(Activity activity, String str, String str2, int i) {
        p.i(activity, "activity");
        p.i(str, "title");
        return w7(new r(activity, str, str2, 2131891290, 2131891194, i, false, 0, null, 0, null, null, 4032, null));
    }

    public static ti.r F2(Activity activity, int i, int i2, int i3, boolean z, int i4, Object obj) {
        if ((i4 & 8) != 0) {
            i3 = -1;
        }
        if ((i4 & 16) != 0) {
            z = false;
        }
        return E2(activity, i, i2, i3, z);
    }

    public static final ti.r<pe> F3(final Activity activity, final se seVar) {
        p.i(activity, "activity");
        p.i(seVar, "error");
        if (ac.a.e1(ac.f, activity, 0, 2, (Object) null).i0()) {
            ti.r<pe> w = ti.r.w(new ue());
            p.h(w, "just(...)");
            return w;
        }
        ti.r<p1> w72 = w7(new r(activity, 2131887507, b7.j6(2131887289, activity, new Object[0]), 2131886894, 2131886892, 0, false, 0, (String) null, 0, (Integer) null, 2016, (h) null));
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                ti.v H3;
                H3 = com.joaomgcd.taskerm.dialog.a.H3(activity, seVar, (p1) obj);
                return H3;
            }
        };
        ti.r<pe> t = w72.t(new yi.e() {
            public final Object a(Object obj) {
                ti.v I3;
                I3 = com.joaomgcd.taskerm.dialog.a.I3(lVar, obj);
                return I3;
            }
        });
        p.h(t, "flatMap(...)");
        return t;
    }

    public static final o1 F4(List list, com.joaomgcd.taskerm.util.d dVar) {
        p.i(dVar, "it");
        String g = dVar.g();
        if (g == null) {
            g = "Unknown Service";
        }
        return new o1(g, null, list.contains(dVar.h()), 2, null);
    }

    public static final void F5(sj.d dVar, DialogInterface dialogInterface) {
        e2.i2(dVar, new RuntimeException("Dismissed"));
    }

    public static final ti.r<String[]> F6(final Activity activity, final boolean z, final boolean z2, final boolean z3, final boolean z4, final boolean z5, final boolean z10, final boolean z11, final String str, final Long l) {
        p.i(activity, "activity");
        return e2.y1(new ik.a() {
            public final Object e() {
                String[] H6;
                H6 = com.joaomgcd.taskerm.dialog.a.H6(activity, z, str, l, z3, z4, z5, z2, z11, z10);
                return H6;
            }
        });
    }

    public static ti.r F7(Activity activity, String str, String str2, int i, int i2, Object obj) {
        if ((i2 & 8) != 0) {
            i = -1;
        }
        return E7(activity, str, str2, i);
    }

    public static final ti.r<p1> G2(Activity activity) {
        p.i(activity, "activity");
        return h6(activity, "device_owner", "android.permission.DEVICE_OWNER", 2131887187, false, false, false, 80, null);
    }

    public static ti.r G3(Activity activity, se seVar, int i, Object obj) {
        if ((i & 2) != 0) {
            seVar = ac.f.T(activity);
        }
        return F3(activity, seVar);
    }

    public static final ti.r<t7<String>> G4(Activity activity, com.joaomgcd.taskerm.util.e0 e0Var) {
        p.i(activity, "context");
        p.i(e0Var, "title");
        return x0.c0(new s7(activity, e0Var.b(), t.O0(ug.u(activity.getContentResolver(), -1, true, true).keySet()), false, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 262136, null));
    }

    public static final ti.r<String> G5(Activity activity) {
        Set availableZoneIds;
        p.i(activity, "activity");
        availableZoneIds = ZoneId.getAvailableZoneIds();
        p.h(availableZoneIds, "getAvailableZoneIds(...)");
        ti.r c0 = x0.c0(new s7(activity, 2131890832, t.O0(availableZoneIds), false, (l) null, (Integer) null, (l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 65528, (h) null));
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                String H5;
                H5 = com.joaomgcd.taskerm.dialog.a.H5((t7) obj);
                return H5;
            }
        };
        ti.r<String> x = c0.x(new yi.e() {
            public final Object a(Object obj) {
                String I5;
                I5 = com.joaomgcd.taskerm.dialog.a.I5(lVar, obj);
                return I5;
            }
        });
        p.h(x, "map(...)");
        return x;
    }

    public static ti.r G6(Activity activity, boolean z, boolean z2, boolean z3, boolean z4, boolean z5, boolean z10, boolean z11, String str, Long l, int i, Object obj) {
        if ((i & 2) != 0) {
            z = false;
        }
        if ((i & 4) != 0) {
            z2 = true;
        }
        if ((i & 8) != 0) {
            z3 = true;
        }
        if ((i & 16) != 0) {
            z4 = true;
        }
        if ((i & 32) != 0) {
            z5 = true;
        }
        if ((i & 64) != 0) {
            z10 = false;
        }
        if ((i & 128) != 0) {
            z11 = false;
        }
        if ((i & 256) != 0) {
            str = null;
        }
        if ((i & 512) != 0) {
            l = null;
        }
        return F6(activity, z, z2, z3, z4, z5, z10, z11, str, l);
    }

    public static final ti.r<p1> G7(final Activity activity) {
        p.i(activity, "activity");
        if (!com.joaomgcd.taskerm.util.r.a.p()) {
            return h6(activity, "volume_long_press_grant", "android.permission.SET_VOLUME_KEY_LONG_PRESS_LISTENER", 2131887363, false, false, false, 112, null);
        }
        ti.r<p1> l = ti.r.l(new u() {
            public final void a(ti.s sVar) {
                com.joaomgcd.taskerm.dialog.a.H7(activity, sVar);
            }
        });
        p.h(l, "create(...)");
        return l;
    }

    public static final ti.r<p1> H2(Activity activity) {
        p.i(activity, "activity");
        return h6(activity, "dump_grant", "android.permission.DUMP", 2131887191, false, false, false, 112, null);
    }

    public static final v H3(Activity activity, se seVar, p1 p1Var) {
        p.i(p1Var, "it");
        if (p1Var.o()) {
            return new GenericActionActivityRequestNotificationAccess().run(activity);
        }
        ti.r w = ti.r.w(seVar);
        p.f(w);
        return w;
    }

    public static final ti.r<t7<String>> H4(Activity activity, com.joaomgcd.taskerm.util.e0 e0Var) {
        p.i(activity, "context");
        p.i(e0Var, "title");
        String b2 = e0Var.b();
        List K = ug.K(activity.getContentResolver(), (String) null);
        p.h(K, "getTitleList(...)");
        return x0.c0(new s7(activity, b2, K, false, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 262136, null));
    }

    public static final String H5(t7 t7Var) {
        p.i(t7Var, "it");
        String str = (String) t7Var.c();
        return str == null ? "" : str;
    }

    public static final String[] H6(final Activity activity, boolean z, String str, Long l, boolean z2, boolean z3, boolean z4, boolean z5, boolean z10, boolean z11) {
        List d2;
        String j;
        ArrayList arrayList = new ArrayList();
        if (z2) {
            arrayList.add(new Pair(2131886706, 2131232020));
        }
        if (!Kid.a()) {
            t.C(arrayList, new Pair[]{new Pair(2131891199, 2131231414), new Pair(2131891217, 2131231755), new Pair(2131890561, 2131230922)});
        }
        if (z3) {
            arrayList.add(new Pair(2131889622, 2131232021));
        }
        if (z4) {
            arrayList.add(new Pair(2131890053, 2131232022));
        }
        if (z5) {
            arrayList.add(new Pair(2131887107, 2131232166));
        }
        if (z10) {
            arrayList.add(new Pair(2131886983, 2131231113));
        }
        if (z11) {
            arrayList.add(new Pair(2131886752, 2131231779));
        }
        Pair pair = (Pair) ((t7) x0.c0(new s7(activity, 2131886999, (List) arrayList, false, new l() {
            public final Object invoke(Object obj) {
                o1 I6;
                I6 = com.joaomgcd.taskerm.dialog.a.I6(activity, (Pair) obj);
                return I6;
            }
        }, (Integer) null, (l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 65504, (h) null)).f()).c();
        if (pair == null) {
            throw new RuntimeException("Didn't select image type");
        }
        int intValue = ((Number) pair.getFirst()).intValue();
        switch (intValue) {
            case 2131886706:
                String b2 = IconProvider.a.b(IconProvider.i, (String) ((we) q6(activity, null, null, false, null, 30, null).f()).d(), (String) null, 2, (Object) null);
                if (b2 != null) {
                    return new String[]{b2};
                }
                throw new RuntimeException("Didn't select an app");
            case 2131886752:
                String c2 = ((p1) w7(new r(activity, b7.a6(2131886752, activity), null, null, null, null, true, 0, b7.j6(2131886753, activity, new Object[0]), 0, null, null, null, 7868, null)).f()).c();
                if (c2 == null) {
                    throw new RuntimeException("Didn't enter anything");
                }
                return new String[]{bg.l.z() + bg.h.a.w(c2)};
            case 2131886983:
                return new String[]{IconProvider.i.d()};
            case 2131887107:
                List p = t.p(new Integer[]{2131888380, 2131888440});
                l lVar = new l() {
                    public final Object invoke(Object obj) {
                        o1 J6;
                        J6 = com.joaomgcd.taskerm.dialog.a.J6(activity, ((Integer) obj).intValue());
                        return J6;
                    }
                };
                if (z) {
                    String str2 = null;
                    d2 = ((i8) x0.E(new df.n(activity, new h0(activity, intValue, new Object[0]), p, false, lVar, null, null, null, null, null, null, null, str2, str2, str2, null, 65512, null)).f()).c();
                } else {
                    Integer num = (Integer) ((t7) x0.c0(new s7(activity, intValue, p, false, lVar, (Integer) null, (l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 65512, (h) null)).f()).c();
                    if (num == null) {
                        throw new RuntimeException("Type of wallpaper not selected");
                    }
                    d2 = t.d(num);
                }
                ArrayList arrayList2 = new ArrayList(t.w(d2, 10));
                Iterator it = d2.iterator();
                while (it.hasNext()) {
                    int intValue2 = ((Number) it.next()).intValue();
                    if (intValue2 == 2131888380) {
                        j = IconProvider.i.j(gr.a.i);
                    } else {
                        if (intValue2 != 2131888440) {
                            throw new RuntimeException("Invalid type of wallpaper");
                        }
                        j = IconProvider.i.j(gr.a.q);
                    }
                    arrayList2.add(j);
                }
                return (String[]) arrayList2.toArray(new String[0]);
            case 2131889622:
                Object f2 = B6(activity, "image/*", z, str, false, false, false, l, 112, null).f();
                p.h(f2, "blockingGet(...)");
                return (String[]) f2;
            case 2131890053:
                String c3 = ((p1) w7(new r(activity, 2131890053, (String) null, 0, 0, 0, true, 0, (String) null, 0, (Integer) null, 1976, (h) null)).f()).c();
                if (c3 != null) {
                    return new String[]{c3};
                }
                throw new RuntimeException("Didn't enter a URL");
            case 2131890561:
                Object f3 = D2(activity, false, 2, null).f();
                p.h(f3, "blockingGet(...)");
                return new String[]{f3};
            case 2131891199:
                Object f4 = z2(activity, false, 2, null).f();
                p.h(f4, "blockingGet(...)");
                return new String[]{f4};
            case 2131891217:
                Object f5 = B2(activity, false, 2, null).f();
                p.h(f5, "blockingGet(...)");
                return new String[]{f5};
            default:
                throw new RuntimeException("Not a valid type of image selection");
        }
    }

    public static final void H7(Activity activity, s sVar) {
        p.i(sVar, "it");
        l7.c1("Need at least Android 8 to handle long volume press events", activity);
        sVar.b(new p1(1, null, 2, null));
    }

    public static final ti.r<p1> I2(Activity activity, String str, String str2, int i) {
        p.i(activity, "activity");
        p.i(str, "title");
        return w7(new r(activity, str, str2, 2131889605, 2131888831, i, false, 0, null, 0, null, null, 4032, null));
    }

    public static final v I3(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    public static final ti.r<p1> I4(final Activity activity, final int i) {
        p.i(activity, "context");
        return c8(new l() {
            public final Object invoke(Object obj) {
                vj.e0 J4;
                J4 = com.joaomgcd.taskerm.dialog.a.J4(activity, i, (x7) obj);
                return J4;
            }
        }, null, 2, null);
    }

    public static final String I5(l lVar, Object obj) {
        p.i(obj, "p0");
        return (String) lVar.invoke(obj);
    }

    public static final o1 I6(Activity activity, Pair pair) {
        p.i(pair, "it");
        return new o1(b7.j6(((Number) pair.getFirst()).intValue(), activity, new Object[0]), new g(activity.getResources(), ((Number) pair.getSecond()).intValue()), false, 4, null);
    }

    public static final ti.r<p1> I7(Activity activity, int i, int i2) {
        p.i(activity, "activity");
        return N7(activity, i, i2, 0, 8, null);
    }

    public static ti.r J2(Activity activity, String str, String str2, int i, int i2, Object obj) {
        if ((i2 & 4) != 0) {
            str2 = b7.j6(2131887686, activity, new Object[]{str});
        }
        if ((i2 & 8) != 0) {
            i = -1;
        }
        return I2(activity, str, str2, i);
    }

    public static final ti.r<p1> J3(Activity activity) {
        p.i(activity, "activity");
        return w7(new r(activity, 2131887507, b7.j6(2131887190, activity, new Object[0]), 2131886894, 2131886892, 0, false, 0, (String) null, 0, (Integer) null, 2016, (h) null));
    }

    public static final e0 J4(Activity activity, int i, x7 x7Var) {
        p.i(x7Var, "it");
        a1.y(activity, x7Var, i).x(activity);
        return e0.a;
    }

    public static final ti.r<ScanResult> J5(final Activity activity, final l<? super ScanResult, String> lVar) {
        p.i(activity, "context");
        p.i(lVar, "scanResultToString");
        return e2.y1(new ik.a() {
            public final Object e() {
                ScanResult M5;
                M5 = com.joaomgcd.taskerm.dialog.a.M5(activity, lVar);
                return M5;
            }
        });
    }

    public static final o1 J6(Activity activity, int i) {
        return new o1(b7.j6(i, activity, new Object[0]), null, false, 6, null);
    }

    public static final ti.r<p1> J7(Activity activity, int i, int i2, int i3) {
        p.i(activity, "activity");
        return w7(new r(activity, i, i2, 2131886910, 2131886892, i3, false, 0, (String) null, 0, (Integer) null, 1984, (h) null));
    }

    @TargetApi(30)
    public static final ti.r<rf.d> K2(final Activity activity) {
        p.i(activity, "context");
        return e2.y1(new ik.a() {
            public final Object e() {
                rf.d L2;
                L2 = com.joaomgcd.taskerm.dialog.a.L2(activity);
                return L2;
            }
        });
    }

    public static final ti.r<pe> K3(Activity activity, final se seVar) {
        p.i(activity, "activity");
        p.i(seVar, "error");
        if (ac.a.z1(ac.f, activity, 0, 2, (Object) null).i0()) {
            ti.r<pe> w = ti.r.w(new ue());
            p.h(w, "just(...)");
            return w;
        }
        ti.r<p1> w72 = w7(new r(activity, 2131887507, b7.j6(2131887274, activity, new Object[0]), 2131886894, 0, 0, false, 0, (String) null, 0, (Integer) null, 2032, (h) null));
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                ti.v M3;
                M3 = com.joaomgcd.taskerm.dialog.a.M3(seVar, (p1) obj);
                return M3;
            }
        };
        ti.r<pe> t = w72.t(new yi.e() {
            public final Object a(Object obj) {
                ti.v N3;
                N3 = com.joaomgcd.taskerm.dialog.a.N3(lVar, obj);
                return N3;
            }
        });
        p.h(t, "flatMap(...)");
        return t;
    }

    public static final ti.r<ContactData> K4(final Context context, final String str, final i iVar, final Long l) {
        p.i(context, "context");
        return e2.y1(new ik.a() {
            public final Object e() {
                ContactData M4;
                M4 = com.joaomgcd.taskerm.dialog.a.M4(str, iVar, l, context);
                return M4;
            }
        });
    }

    public static ti.r K5(Activity activity, l lVar, int i, Object obj) {
        if ((i & 2) != 0) {
            lVar = new l() {
                public final Object invoke(Object obj2) {
                    String L5;
                    L5 = com.joaomgcd.taskerm.dialog.a.L5((ScanResult) obj2);
                    return L5;
                }
            };
        }
        return J5(activity, lVar);
    }

    public static final java.lang.Object K6(android.app.Activity r17, java.lang.String r18, zj.e<? super java.lang.String> r19) {
        throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.taskerm.dialog.a.K6(android.app.Activity, java.lang.String, zj.e):java.lang.Object");
    }

    public static final ti.r<p1> K7(Activity activity, int i, String str, int i2) {
        p.i(activity, "activity");
        return w7(new r(activity, i, str, 2131886910, 2131886892, i2, false, 0, (String) null, 0, (Integer) null, 1984, (h) null));
    }

    public static final rf.d L2(final Activity activity) {
        ArrayList t = d4.t(activity);
        if (t.size() == 1) {
            p.f(t);
            Object e0 = t.e0(t);
            p.h(e0, "first(...)");
            return M2(rf.a.e(activity, (String) e0, false, 2, (Object) null), activity);
        }
        p.f(t);
        String str = (String) ((t7) x0.c0(new s7(activity, 2131887762, (List) t, true, com.joaomgcd.taskerm.util.r.a.o() ? new l() {
            public final Object invoke(Object obj) {
                o1 O2;
                O2 = com.joaomgcd.taskerm.dialog.a.O2((String) obj);
                return O2;
            }
        } : new l() {
            public final Object invoke(Object obj) {
                o1 P2;
                P2 = com.joaomgcd.taskerm.dialog.a.P2(activity, (String) obj);
                return P2;
            }
        }, (Integer) null, (l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, Boolean.FALSE, 32736, (h) null)).f()).c();
        if (str != null) {
            return M2(rf.a.e(activity, str, false, 2, (Object) null), activity);
        }
        throw new RuntimeException("Nothing selected");
    }

    public static ti.r L3(Activity activity, se seVar, int i, Object obj) {
        if ((i & 2) != 0) {
            seVar = ac.f.T(activity);
        }
        return K3(activity, seVar);
    }

    public static ti.r L4(Context context, String str, i iVar, Long l, int i, Object obj) {
        if ((i & 2) != 0) {
            str = null;
        }
        if ((i & 4) != 0) {
            iVar = null;
        }
        if ((i & 8) != 0) {
            l = null;
        }
        return K4(context, str, iVar, l);
    }

    public static final String L5(ScanResult scanResult) {
        p.i(scanResult, "<this>");
        return b7.b4(scanResult);
    }

    private static final <T extends f5> ti.r<t7<T>> L6(Activity activity, int i, go goVar, String str, List<? extends T> list, boolean z) {
        Integer num = null;
        if (list == null) {
            return null;
        }
        int i2 = 0;
        if (z && list.size() == 1) {
            return ti.r.w(new t7(new df.j7(3, null, 2, null), list.get(0), null, 4, null));
        }
        if (str != null && str.length() != 0) {
            Iterator<? extends T> it = list.iterator();
            while (true) {
                if (!it.hasNext()) {
                    i2 = -1;
                    break;
                }
                T next = it.next();
                if (next.getName() != null) {
                    String name = next.getName();
                    p.h(name, "getName(...)");
                    if (p.d(l7.U(name), l7.U(str))) {
                        break;
                    }
                }
                i2++;
            }
            num = Integer.valueOf(i2);
        }
        return x0.c0(new s7(activity, i, (List) list, true, new l() {
            public final Object invoke(Object obj) {
                o1 M6;
                M6 = com.joaomgcd.taskerm.dialog.a.M6((net.dinglisch.android.taskerm.f5) obj);
                return M6;
            }
        }, (Integer) null, (l) null, (Boolean) null, (Boolean) null, (Integer) null, num, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 64480, (h) null));
    }

    public static final ti.r<p1> L7(Activity activity, String str, String str2) {
        p.i(activity, "activity");
        p.i(str, "title");
        return P7(activity, str, str2, 0, 8, null);
    }

    private static final rf.d M2(rf.d dVar, Activity activity) {
        j0 j0Var = new j0();
        j0Var.i = dVar.A().getAbsoluteFile();
        String N2 = N2(activity, j0Var);
        if (N2 != null) {
            j0Var.i = new File(N2);
        }
        if (d4.E(activity, (File) j0Var.i, true, true)) {
            Object obj = j0Var.i;
            p.h(obj, "element");
            return rf.a.d(activity, (File) obj, false, 2, (Object) null);
        }
        if (!((p1) b4(activity, 2131888888, 2131887269, 0, false, null, 56, null).f()).o()) {
            throw new RuntimeException("Doesn't have needed permission");
        }
        we weVar = (pe) new GenericActionActivityGrantUriPermission(dVar.A()).run(activity).f();
        if (!weVar.b()) {
            throw new RuntimeException(weVar.a());
        }
        we weVar2 = weVar instanceof we ? weVar : null;
        rf.d dVar2 = weVar2 != null ? (rf.d) weVar2.d() : null;
        if (dVar2 != null) {
            return dVar2;
        }
        if (d4.E(activity, (File) j0Var.i, true, true)) {
            return dVar;
        }
        throw new RuntimeException("Doesn't have access to " + j0Var.i);
    }

    public static final v M3(se seVar, p1 p1Var) {
        p.i(p1Var, "it");
        return ti.r.w(seVar);
    }

    public static final ContactData M4(String str, i iVar, Long l, Context context) {
        ContactData contactData;
        we weVar = (pe) ((str == null || str.length() == 0) ? new GenericActionPickContact(iVar, l) : new GenericActionPickContactWithMimeType(str)).run(context).f();
        if (!weVar.b()) {
            throw new RuntimeException(weVar.a());
        }
        we weVar2 = weVar instanceof we ? weVar : null;
        if (weVar2 == null || (contactData = (ContactData) weVar2.d()) == null) {
            throw new RuntimeException("Couldn't get contact");
        }
        return contactData;
    }

    public static final ScanResult M5(Activity activity, final l lVar) {
        if (!ExtensionsContextKt.z3(activity)) {
            if (!((p1) N7(activity, 2131891107, 2131887272, 0, 8, null).f()).o()) {
                throw new RuntimeException("Didn't want enable location");
            }
            pe peVar = (pe) new GenericActionActivityEnableLocation().run(activity).f();
            if (!peVar.b()) {
                throw new RuntimeException(peVar.a());
            }
        }
        WifiManager g3 = ExtensionsContextKt.g3(activity);
        if (g3 == null || !g3.isWifiEnabled()) {
            throw new RuntimeException("Wifi is disabled on your device");
        }
        List g2 = ExtensionsContextKt.g2(activity);
        HashSet hashSet = new HashSet();
        ArrayList arrayList = new ArrayList();
        for (Object obj : g2) {
            ScanResult scanResult = (ScanResult) obj;
            p.f(scanResult);
            if (hashSet.add((String) lVar.invoke(scanResult))) {
                arrayList.add(obj);
            }
        }
        ArrayList arrayList2 = new ArrayList();
        for (Object obj2 : arrayList) {
            ScanResult scanResult2 = (ScanResult) obj2;
            p.f(scanResult2);
            if (l7.x0((String) lVar.invoke(scanResult2))) {
                arrayList2.add(obj2);
            }
        }
        ScanResult scanResult3 = (ScanResult) ((t7) x0.c0(new s7(activity, 2131890093, (List) arrayList2, false, new l() {
            public final Object invoke(Object obj3) {
                o1 N5;
                N5 = com.joaomgcd.taskerm.dialog.a.N5(lVar, (ScanResult) obj3);
                return N5;
            }
        }, (Integer) null, (l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 65512, (h) null)).f()).c();
        if (scanResult3 != null) {
            return scanResult3;
        }
        throw new RuntimeException("No network selected");
    }

    public static final o1 M6(f5 f5Var) {
        p.i(f5Var, "it");
        String name = f5Var.getName();
        p.h(name, "getName(...)");
        return new o1(name, f5Var.getIcon(), false, 4, null);
    }

    public static final ti.r<p1> M7(Activity activity, String str, String str2, int i) {
        p.i(activity, "activity");
        p.i(str, "title");
        return w7(new r(activity, str, str2, 2131886910, 2131886892, i, false, 0, null, 0, null, null, 4032, null));
    }

    private static final String N2(Activity activity, j0<File> j0Var) {
        Uri uri;
        String j0;
        List<UriPermission> a2 = ud.z.a(activity.getContentResolver());
        if (a2 != null && !a2.isEmpty()) {
            String absolutePath = ((File) j0Var.i).getAbsolutePath();
            for (UriPermission uriPermission : a2) {
                if (uriPermission != null && (uri = uriPermission.getUri()) != null && (j0 = ph.j0(uri, activity)) != null) {
                    p.f(absolutePath);
                    if (q.U(j0, absolutePath, false, 2, (Object) null)) {
                        return j0;
                    }
                }
            }
        }
        return null;
    }

    public static final v N3(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    public static final ti.r<String> N4(final Activity activity, final Long l) {
        p.i(activity, "activity");
        return e2.y1(new ik.a() {
            public final Object e() {
                String O4;
                O4 = com.joaomgcd.taskerm.dialog.a.O4(activity, l);
                return O4;
            }
        });
    }

    public static final o1 N5(l lVar, ScanResult scanResult) {
        p.f(scanResult);
        return new o1((String) lVar.invoke(scanResult), null, false, 6, null);
    }

    public static final ti.r<t7<z3>> N6(Activity activity) {
        ik.a aVar;
        int i;
        com.joaomgcd.taskerm.dialog.b bVar;
        p.i(activity, "activity");
        com.joaomgcd.taskerm.dialog.b g = b.a.g(com.joaomgcd.taskerm.dialog.b.c, activity, 2131887201, false, 4, null);
        try {
            KeyboardApps keyboardApps = new KeyboardApps(activity);
            com.joaomgcd.taskerm.dialog.b.h(g, null, 1, null);
            try {
                ti.r<t7<z3>> c0 = x0.c0(new s7(activity, 2131886549, (List) keyboardApps, true, new l() {
                    public final Object invoke(Object obj) {
                        o1 O6;
                        O6 = com.joaomgcd.taskerm.dialog.a.O6((je.z3) obj);
                        return O6;
                    }
                }, (Integer) null, (l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 65504, (h) null));
                com.joaomgcd.taskerm.dialog.b.h(g, null, 1, null);
                return c0;
            } catch (Throwable th) {
                th = th;
                bVar = g;
                i = 1;
                aVar = null;
                com.joaomgcd.taskerm.dialog.b.h(bVar, aVar, i, aVar);
                throw th;
            }
        } catch (Throwable th2) {
            th = th2;
            aVar = null;
            i = 1;
            bVar = g;
        }
    }

    public static ti.r N7(Activity activity, int i, int i2, int i3, int i4, Object obj) {
        if ((i4 & 8) != 0) {
            i3 = -1;
        }
        return J7(activity, i, i2, i3);
    }

    public static final o1 O2(String str) {
        p.f(str);
        return new o1(str, null, false, 6, null);
    }

    public static final ti.r<p1> O3(final Activity activity) {
        p.i(activity, "activity");
        if (!com.joaomgcd.taskerm.util.r.a.r()) {
            return h6(activity, "work_profile", "android.permission.MODIFY_QUIET_MODE", 2131887312, false, false, false, 112, null);
        }
        ti.r<p1> l = ti.r.l(new u() {
            public final void a(ti.s sVar) {
                com.joaomgcd.taskerm.dialog.a.P3(activity, sVar);
            }
        });
        p.h(l, "create(...)");
        return l;
    }

    public static final String O4(Activity activity, Long l) {
        String[] i = oh.i(activity, 2130903082);
        p.h(i, "getStringArray(...)");
        Integer b2 = ((t7) x0.c0(new s7(activity, 2131886280, n.C0(i), false, (l) null, (Integer) null, (l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 65528, (h) null)).f()).b();
        if (b2 == null) {
            throw new RuntimeException("Did not select a group");
        }
        int intValue = b2.intValue();
        if (intValue == 0) {
            String name = ((ContactData) L4(activity, null, i.q, l, 2, null).f()).getName();
            if (name != null) {
                return name;
            }
            throw new RuntimeException("Contact doesn't have a name");
        }
        if (intValue == 1) {
            return "C:FAV";
        }
        if (intValue != 2) {
            return "C:ANY";
        }
        String[] g = xg.g(activity, false);
        p.f(g);
        String str = (String) ((t7) x0.c0(new s7(activity, 2131886280, n.C0(g), false, (l) null, (Integer) null, (l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 65528, (h) null)).f()).c();
        if (str != null) {
            String str2 = "CG:" + str;
            if (str2 != null) {
                return str2;
            }
        }
        throw new RuntimeException("No contact group selected");
    }

    public static final ti.r<String> O5(final Activity activity, l<? super ScanResult, String> lVar) {
        p.i(activity, "context");
        p.i(lVar, "scanResultToString");
        ti.r K5 = K5(activity, null, 2, null);
        final l lVar2 = new l() {
            public final Object invoke(Object obj) {
                ti.v R5;
                R5 = com.joaomgcd.taskerm.dialog.a.R5(activity, (ScanResult) obj);
                return R5;
            }
        };
        ti.r<String> t = K5.t(new yi.e() {
            public final Object a(Object obj) {
                ti.v U5;
                U5 = com.joaomgcd.taskerm.dialog.a.U5(lVar2, obj);
                return U5;
            }
        });
        p.h(t, "flatMap(...)");
        return t;
    }

    public static final o1 O6(z3 z3Var) {
        p.i(z3Var, "it");
        String name = z3Var.getName();
        if (name == null) {
            name = "Unknown App";
        }
        return new o1(name, null, false, 6, null);
    }

    public static ti.r O7(Activity activity, int i, String str, int i2, int i3, Object obj) {
        if ((i3 & 8) != 0) {
            i2 = -1;
        }
        return K7(activity, i, str, i2);
    }

    public static final o1 P2(Activity activity, String str) {
        p.i(str, "path");
        return new o1(ph.V(ph.u0(activity, str), activity, str), null, false, 6, null);
    }

    public static final void P3(Activity activity, s sVar) {
        p.i(sVar, "it");
        l7.c1("Need at least Android 10 to toggle work profile", activity);
        sVar.b(new p1(1, null, 2, null));
    }

    public static final ti.r<f8> P4(final Activity activity, final f8 f8Var, final String str, final String str2) {
        p.i(activity, "activity");
        final Calendar calendar = Calendar.getInstance();
        final sj.d V = sj.d.V();
        p.h(V, "create(...)");
        final ik.r rVar = new ik.r() {
            public final Object j(Object obj, Object obj2, Object obj3, Object obj4) {
                vj.e0 R4;
                R4 = com.joaomgcd.taskerm.dialog.a.R4(V, (DatePicker) obj, ((Integer) obj2).intValue(), ((Integer) obj3).intValue(), ((Integer) obj4).intValue());
                return R4;
            }
        };
        e2.a1(new ik.a() {
            public final Object e() {
                vj.e0 S4;
                S4 = com.joaomgcd.taskerm.dialog.a.S4(activity, rVar, f8Var, calendar, str, str2, V);
                return S4;
            }
        });
        return V;
    }

    public static ti.r P5(Activity activity, l lVar, int i, Object obj) {
        if ((i & 2) != 0) {
            lVar = new l() {
                public final Object invoke(Object obj2) {
                    String Q5;
                    Q5 = com.joaomgcd.taskerm.dialog.a.Q5((ScanResult) obj2);
                    return Q5;
                }
            };
        }
        return O5(activity, lVar);
    }

    public static final ti.r<we<String, j3>> P6(Context context) {
        p.i(context, "context");
        return q6(context, mh.p(), null, false, null, 28, null);
    }

    public static ti.r P7(Activity activity, String str, String str2, int i, int i2, Object obj) {
        if ((i2 & 8) != 0) {
            i = -1;
        }
        return M7(activity, str, str2, i);
    }

    public static final ti.r<p1> Q2(final df.c cVar) {
        p.i(cVar, "args");
        return e2.y1(new ik.a() {
            public final Object e() {
                p1 R2;
                R2 = com.joaomgcd.taskerm.dialog.a.R2(c.this);
                return R2;
            }
        });
    }

    public static final ti.r<p1> Q3(Activity activity) {
        p.i(activity, "activity");
        return w7(new r(activity, 2131887513, 2131887273, 2131886894, 2131886892, 0, false, 0, (String) null, 0, (Integer) null, 2016, (h) null));
    }

    public static ti.r Q4(Activity activity, f8 f8Var, String str, String str2, int i, Object obj) {
        if ((i & 2) != 0) {
            f8Var = null;
        }
        if ((i & 4) != 0) {
            str = null;
        }
        if ((i & 8) != 0) {
            str2 = null;
        }
        return P4(activity, f8Var, str, str2);
    }

    public static final String Q5(ScanResult scanResult) {
        p.i(scanResult, "<this>");
        return b7.b4(scanResult);
    }

    @TargetApi(26)
    public static final ti.r<t7<NotificationChannel>> Q6(final Activity activity, final String str) {
        p.i(activity, "activity");
        return e2.y1(new ik.a() {
            public final Object e() {
                t7 S6;
                S6 = com.joaomgcd.taskerm.dialog.a.S6(activity, str);
                return S6;
            }
        });
    }

    public static final ti.r<p1> Q7(Activity activity, int i, int i2) {
        p.i(activity, "activity");
        return S7(activity, i, i2, null, 8, null);
    }

    public static final p1 R2(df.c cVar) {
        try {
            new ActionDialogHTML(cVar.b(), cVar.c()).run(cVar.a()).f();
            return new p1(0, null, 2, null);
        } catch (Exception unused) {
            return new p1(1, null, 2, null);
        }
    }

    public static final ti.r<p1> R3(Activity activity, int i, int i2) {
        p.i(activity, "activity");
        return w7(new r(activity, i, i2, 2131886894, 0, 0, false, 0, (String) null, 0, (Integer) null, 2032, (h) null));
    }

    public static final e0 R4(sj.d dVar, DatePicker datePicker, int i, int i2, int i3) {
        p.i(datePicker, "view");
        dVar.b(new f8(i, i2 + 1, i3));
        return e0.a;
    }

    public static final v R5(Activity activity, final ScanResult scanResult) {
        p.i(scanResult, "scanResult");
        ti.r<p1> S1 = S1(activity, b7.a6(2131889810, activity), b7.a6(2131889811, activity), b7.a6(2131889804, activity), b7.a6(2131889756, activity));
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                String S5;
                S5 = com.joaomgcd.taskerm.dialog.a.S5(scanResult, (p1) obj);
                return S5;
            }
        };
        return S1.x(new yi.e() {
            public final Object a(Object obj) {
                String T5;
                T5 = com.joaomgcd.taskerm.dialog.a.T5(lVar, obj);
                return T5;
            }
        });
    }

    public static ti.r R6(Activity activity, String str, int i, Object obj) {
        if ((i & 2) != 0) {
            str = n2.A.f().a();
        }
        return Q6(activity, str);
    }

    public static final ti.r<p1> R7(final Activity activity, final int i, final int i2, com.joaomgcd.taskerm.util.e0 e0Var) {
        p.i(activity, "activity");
        if (e0Var == null) {
            e0Var = new h0(activity, i2, new Object[0]);
        }
        return rg.i.i(activity, e0Var, new ik.a() {
            public final Object e() {
                ti.r V7;
                V7 = com.joaomgcd.taskerm.dialog.a.V7();
                return V7;
            }
        }, new l() {
            public final Object invoke(Object obj) {
                boolean T7;
                T7 = com.joaomgcd.taskerm.dialog.a.T7((p1) obj);
                return Boolean.valueOf(T7);
            }
        }, (SharedPreferences) null, new ik.a() {
            public final Object e() {
                ti.r U7;
                U7 = com.joaomgcd.taskerm.dialog.a.U7(activity, i, i2);
                return U7;
            }
        }, 8, (Object) null);
    }

    public static final ti.r<p1> S1(Activity activity, com.joaomgcd.taskerm.util.e0 e0Var, com.joaomgcd.taskerm.util.e0 e0Var2, com.joaomgcd.taskerm.util.e0 e0Var3, com.joaomgcd.taskerm.util.e0 e0Var4) {
        p.i(activity, "activity");
        p.i(e0Var, "title");
        p.i(e0Var2, "text");
        p.i(e0Var3, "positiveLabel");
        p.i(e0Var4, "negativeLabel");
        return w7(new r(activity, e0Var, e0Var2, e0Var3, e0Var4, null, false, 0, null, 0, null, null, null, 8160, null));
    }

    public static final ti.r<String> S2(Activity activity, int i) {
        p.i(activity, "activity");
        return V2(activity, i, null, null, null, null, null, 124, null);
    }

    public static final ti.r<p1> S3(Activity activity, int i, String str) {
        p.i(activity, "activity");
        return w7(new r(activity, i, str, 2131886894, 0, 0, false, 0, (String) null, 0, (Integer) null, 2032, (h) null));
    }

    public static final e0 S4(Activity activity, final ik.r rVar, f8 f8Var, Calendar calendar, String str, String str2, final sj.d dVar) {
        DatePickerDialog datePickerDialog = new DatePickerDialog(activity, new DatePickerDialog.OnDateSetListener() {
            @Override
            public final void onDateSet(DatePicker datePicker, int i, int i2, int i3) {
                com.joaomgcd.taskerm.dialog.a.T4(rVar, datePicker, i, i2, i3);
            }
        }, f8Var != null ? f8Var.c() : calendar.get(1), f8Var != null ? f8Var.b() - 1 : calendar.get(2), f8Var != null ? f8Var.a() : calendar.get(5));
        if (l7.x0(str)) {
            datePickerDialog.setTitle(str);
        }
        if (l7.x0(str2)) {
            datePickerDialog.setMessage(str2);
        }
        datePickerDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
            @Override
            public final void onCancel(DialogInterface dialogInterface) {
                com.joaomgcd.taskerm.dialog.a.U4(dVar, dialogInterface);
            }
        });
        datePickerDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public final void onDismiss(DialogInterface dialogInterface) {
                com.joaomgcd.taskerm.dialog.a.V4(dVar, dialogInterface);
            }
        });
        datePickerDialog.show();
        return e0.a;
    }

    public static final String S5(ScanResult scanResult, p1 p1Var) {
        p.i(p1Var, "it");
        return p1Var.k() ? scanResult.BSSID : scanResult.SSID;
    }

    public static final t7 S6(Activity activity, String str) {
        t7 t7Var = new t7();
        if (com.joaomgcd.taskerm.util.r.a.p()) {
            return t7Var;
        }
        List i = a2.i(activity, str);
        if (i == null) {
            return t7Var;
        }
        if (i.isEmpty()) {
            R3(activity, 2131887290, 2131887371).f();
            return t7Var;
        }
        t7 t7Var2 = (t7) x0.c0(new s7(activity, 2131887290, i, false, new l() {
            public final Object invoke(Object obj) {
                o1 T6;
                T6 = com.joaomgcd.taskerm.dialog.a.T6((NotificationChannel) obj);
                return T6;
            }
        }, (Integer) 2131890912, (l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 65480, (h) null)).f();
        if (!t7Var2.a().r()) {
            p.f(t7Var2);
            return t7Var2;
        }
        l7.e1(b7.j6(2131888723, activity, new Object[0]), activity);
        p4(activity, 2131887290, 2131887174, 0, 0, null, 56, null).f();
        NotificationChannel a2 = androidx.core.app.i.a(t7Var2.c());
        a2.b(activity, a2 != null ? a2.getId() : null);
        Object f2 = R6(activity, null, 2, null).f();
        p.h(f2, "blockingGet(...)");
        return (t7) f2;
    }

    public static ti.r S7(Activity activity, int i, int i2, com.joaomgcd.taskerm.util.e0 e0Var, int i3, Object obj) {
        if ((i3 & 8) != 0) {
            e0Var = null;
        }
        return R7(activity, i, i2, e0Var);
    }

    public static final ti.r<p1> T1(Activity activity, com.joaomgcd.taskerm.util.e0 e0Var, com.joaomgcd.taskerm.util.e0 e0Var2, com.joaomgcd.taskerm.util.e0 e0Var3, com.joaomgcd.taskerm.util.e0 e0Var4, com.joaomgcd.taskerm.util.e0 e0Var5) {
        p.i(activity, "activity");
        p.i(e0Var, "title");
        p.i(e0Var2, "text");
        p.i(e0Var3, "positiveLabel");
        p.i(e0Var4, "negativeLabel");
        p.i(e0Var5, "overrideStopRemindingKey");
        return V1(activity, e0Var, e0Var2, e0Var3, e0Var4, e0Var5, null, null, 192, null);
    }

    public static final ti.r<String> T2(Activity activity, int i, Integer num, com.joaomgcd.taskerm.util.e0 e0Var, Integer num2, Integer num3, List<String> list) {
        p.i(activity, "activity");
        return U2(activity, new h0(activity, i, new Object[0]), num != null ? new h0(activity, num.intValue(), new Object[0]) : null, e0Var, num2, num3, list);
    }

    public static final ti.r<p1> T3(Activity activity, int i, String str, Integer num, Integer num2) {
        p.i(activity, "activity");
        return V3(activity, b7.j6(i, activity, new Object[0]), str, num != null ? new h0(activity, num.intValue(), new Object[0]) : null, num2 != null ? new h0(activity, num2.intValue(), new Object[0]) : null);
    }

    public static final void T4(ik.r rVar, DatePicker datePicker, int i, int i2, int i3) {
        rVar.j(datePicker, Integer.valueOf(i), Integer.valueOf(i2), Integer.valueOf(i3));
    }

    public static final String T5(l lVar, Object obj) {
        p.i(obj, "p0");
        return (String) lVar.invoke(obj);
    }

    public static final o1 T6(NotificationChannel notificationChannel) {
        CharSequence name;
        p.i(notificationChannel, "it");
        name = notificationChannel.getName();
        return new o1(name.toString(), null, false, 6, null);
    }

    public static final boolean T7(p1 p1Var) {
        p.i(p1Var, "it");
        return p1Var.n();
    }

    public static final ti.r<p1> U1(final Activity activity, final com.joaomgcd.taskerm.util.e0 e0Var, final com.joaomgcd.taskerm.util.e0 e0Var2, final com.joaomgcd.taskerm.util.e0 e0Var3, final com.joaomgcd.taskerm.util.e0 e0Var4, com.joaomgcd.taskerm.util.e0 e0Var5, final com.joaomgcd.taskerm.util.e0 e0Var6, SharedPreferences sharedPreferences) {
        p.i(activity, "activity");
        p.i(e0Var, "title");
        p.i(e0Var2, "text");
        p.i(e0Var3, "positiveLabel");
        p.i(e0Var4, "negativeLabel");
        p.i(e0Var5, "overrideStopRemindingKey");
        p.i(e0Var6, "stopRemindingLabel");
        p.i(sharedPreferences, "preferencesForStopReminding");
        return rg.i.h(activity, e0Var5, new ik.a() {
            public final Object e() {
                ti.r W1;
                W1 = com.joaomgcd.taskerm.dialog.a.W1();
                return W1;
            }
        }, new l() {
            public final Object invoke(Object obj) {
                boolean X1;
                X1 = com.joaomgcd.taskerm.dialog.a.X1((p1) obj);
                return Boolean.valueOf(X1);
            }
        }, sharedPreferences, new ik.a() {
            public final Object e() {
                ti.r Y1;
                Y1 = com.joaomgcd.taskerm.dialog.a.Y1(activity, e0Var, e0Var2, e0Var3, e0Var4, e0Var6);
                return Y1;
            }
        });
    }

    public static final ti.r<String> U2(Activity activity, com.joaomgcd.taskerm.util.e0 e0Var, com.joaomgcd.taskerm.util.e0 e0Var2, com.joaomgcd.taskerm.util.e0 e0Var3, Integer num, Integer num2, List<String> list) {
        p.i(activity, "activity");
        p.i(e0Var, "title");
        ti.r d4 = d4(activity, e0Var.b(), e0Var3 != null ? e0Var3.b() : null, 0, true, e0Var2 != null ? e0Var2.b() : null, num, num2 != null ? num2.intValue() : 0, null, list, 264, null);
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                String X2;
                X2 = com.joaomgcd.taskerm.dialog.a.X2((p1) obj);
                return X2;
            }
        };
        ti.r<String> x = d4.x(new yi.e() {
            public final Object a(Object obj) {
                String Y2;
                Y2 = com.joaomgcd.taskerm.dialog.a.Y2(lVar, obj);
                return Y2;
            }
        });
        p.h(x, "map(...)");
        return x;
    }

    public static final ti.r<p1> U3(Activity activity, String str, String str2, com.joaomgcd.taskerm.util.e0 e0Var) {
        p.i(activity, "activity");
        p.i(str, "title");
        return X3(activity, str, str2, e0Var, null, 16, null);
    }

    public static final void U4(sj.d dVar, DialogInterface dialogInterface) {
        e2.i2(dVar, new RuntimeException("Cancelled"));
    }

    public static final v U5(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    public static final ti.r<String> U6(Activity activity, List<String> list) {
        List<String> list2;
        p.i(activity, "activity");
        if (list == null) {
            String[] strArr = od.h;
            p.h(strArr, "KNOWN_PERMS");
            list2 = n.E0(strArr);
            t.C(list2, ac.f.N());
        } else {
            list2 = list;
        }
        ArrayList arrayList = new ArrayList(t.w(list2, 10));
        Iterator<T> it = list2.iterator();
        while (it.hasNext()) {
            arrayList.add(new d(activity, (String) it.next()));
        }
        HashSet hashSet = new HashSet();
        ArrayList arrayList2 = new ArrayList();
        for (Object obj : arrayList) {
            if (hashSet.add(((d) obj).toString())) {
                arrayList2.add(obj);
            }
        }
        ti.r c0 = x0.c0(new s7(activity, 2131886685, (List) arrayList2, false, (l) null, (Integer) null, (l) null, Boolean.TRUE, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 65400, (h) null));
        final l lVar = new l() {
            public final Object invoke(Object obj2) {
                String V6;
                V6 = com.joaomgcd.taskerm.dialog.a.V6((t7) obj2);
                return V6;
            }
        };
        ti.r<String> x = c0.x(new yi.e() {
            public final Object a(Object obj2) {
                String W6;
                W6 = com.joaomgcd.taskerm.dialog.a.W6(lVar, obj2);
                return W6;
            }
        });
        p.h(x, "map(...)");
        return x;
    }

    public static final ti.r U7(Activity activity, int i, int i2) {
        return J7(activity, i, i2, 2131886905);
    }

    public static ti.r V1(Activity activity, com.joaomgcd.taskerm.util.e0 e0Var, com.joaomgcd.taskerm.util.e0 e0Var2, com.joaomgcd.taskerm.util.e0 e0Var3, com.joaomgcd.taskerm.util.e0 e0Var4, com.joaomgcd.taskerm.util.e0 e0Var5, com.joaomgcd.taskerm.util.e0 e0Var6, SharedPreferences sharedPreferences, int i, Object obj) {
        SharedPreferences sharedPreferences2;
        com.joaomgcd.taskerm.util.e0 e0Var7 = (i & 32) != 0 ? e0Var2 : e0Var5;
        com.joaomgcd.taskerm.util.e0 h0Var = (i & 64) != 0 ? new h0(activity, 2131886905, new Object[0]) : e0Var6;
        if ((i & 128) != 0) {
            SharedPreferences w = rg.i.w(activity);
            p.h(w, "<get-preferencesState>(...)");
            sharedPreferences2 = w;
        } else {
            sharedPreferences2 = sharedPreferences;
        }
        return U1(activity, e0Var, e0Var2, e0Var3, e0Var4, e0Var7, h0Var, sharedPreferences2);
    }

    public static ti.r V2(Activity activity, int i, Integer num, com.joaomgcd.taskerm.util.e0 e0Var, Integer num2, Integer num3, List list, int i2, Object obj) {
        return T2(activity, i, (i2 & 4) != 0 ? null : num, (i2 & 8) != 0 ? null : e0Var, (i2 & 16) != 0 ? null : num2, (i2 & 32) != 0 ? null : num3, (i2 & 64) == 0 ? list : null);
    }

    public static final ti.r<p1> V3(Activity activity, String str, String str2, com.joaomgcd.taskerm.util.e0 e0Var, com.joaomgcd.taskerm.util.e0 e0Var2) {
        p.i(activity, "activity");
        p.i(str, "title");
        return w7(new r(activity, new g0(str), str2 != null ? new g0(str2) : null, new h0(activity, 2131886894, new Object[0]), e0Var, e0Var2, false, 0, null, 0, null, null, null, 8128, null));
    }

    public static final void V4(sj.d dVar, DialogInterface dialogInterface) {
        e2.i2(dVar, new RuntimeException("Dismissed"));
    }

    public static final ti.r<p1> V5(Activity activity, int i) {
        p.i(activity, "activity");
        return h6(activity, "read_logs_grant", "android.permission.READ_LOGS", i, true, false, false, 96, null);
    }

    public static final String V6(t7 t7Var) {
        String id2;
        p.i(t7Var, "it");
        d dVar = (d) t7Var.c();
        if (dVar == null || (id2 = dVar.getId()) == null) {
            throw new RuntimeException("No permission selected");
        }
        return id2;
    }

    public static final ti.r V7() {
        ti.r w = ti.r.w(new p1(1, null, 2, null));
        p.h(w, "just(...)");
        return w;
    }

    public static final ti.r W1() {
        ti.r w = ti.r.w(new p1(1, null, 2, null));
        p.h(w, "just(...)");
        return w;
    }

    public static ti.r W2(Activity activity, com.joaomgcd.taskerm.util.e0 e0Var, com.joaomgcd.taskerm.util.e0 e0Var2, com.joaomgcd.taskerm.util.e0 e0Var3, Integer num, Integer num2, List list, int i, Object obj) {
        return U2(activity, e0Var, (i & 4) != 0 ? null : e0Var2, (i & 8) != 0 ? null : e0Var3, (i & 16) != 0 ? null : num, (i & 32) != 0 ? null : num2, (i & 64) == 0 ? list : null);
    }

    public static ti.r W3(Activity activity, int i, String str, Integer num, Integer num2, int i2, Object obj) {
        if ((i2 & 8) != 0) {
            num = null;
        }
        if ((i2 & 16) != 0) {
            num2 = null;
        }
        return T3(activity, i, str, num, num2);
    }

    public static final ti.r<String> W4(Activity activity, String str) {
        p.i(activity, "context");
        p.i(str, "title");
        Locale[] availableLocales = Locale.getAvailableLocales();
        p.h(availableLocales, "getAvailableLocales(...)");
        ArrayList arrayList = new ArrayList();
        for (Locale locale : availableLocales) {
            if (l7.x0(locale.getLanguage()) && l7.x0(locale.getCountry())) {
                arrayList.add(locale);
            }
        }
        ti.r c0 = x0.c0(new s7(activity, str, t.O0(arrayList), true, new l() {
            public final Object invoke(Object obj) {
                o1 X4;
                X4 = com.joaomgcd.taskerm.dialog.a.X4((Locale) obj);
                return X4;
            }
        }, null, null, null, null, null, null, null, null, null, null, null, null, null, 262112, null));
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                String Y4;
                Y4 = com.joaomgcd.taskerm.dialog.a.Y4((t7) obj);
                return Y4;
            }
        };
        ti.r<String> x = c0.x(new yi.e() {
            public final Object a(Object obj) {
                String Z4;
                Z4 = com.joaomgcd.taskerm.dialog.a.Z4(lVar, obj);
                return Z4;
            }
        });
        p.h(x, "map(...)");
        return x;
    }

    public static final ti.r<p1> W5(Activity activity) {
        p.i(activity, "activity");
        return V5(activity, 2131887314);
    }

    public static final String W6(l lVar, Object obj) {
        p.i(obj, "p0");
        return (String) lVar.invoke(obj);
    }

    public static final int W7(boolean z) {
        return z ? 1 : 0;
    }

    public static final boolean X1(p1 p1Var) {
        p.i(p1Var, "it");
        return p1Var.n();
    }

    public static final String X2(p1 p1Var) {
        p.i(p1Var, "it");
        String c2 = p1Var.c();
        if (c2 != null) {
            return c2;
        }
        throw new RuntimeException("No text entered");
    }

    public static ti.r X3(Activity activity, String str, String str2, com.joaomgcd.taskerm.util.e0 e0Var, com.joaomgcd.taskerm.util.e0 e0Var2, int i, Object obj) {
        if ((i & 8) != 0) {
            e0Var = null;
        }
        if ((i & 16) != 0) {
            e0Var2 = null;
        }
        return V3(activity, str, str2, e0Var, e0Var2);
    }

    public static final o1 X4(Locale locale) {
        return new o1(locale.getDisplayLanguage() + "/" + locale.getDisplayCountry(), null, false, 6, null);
    }

    public static final ti.r<p1> X5(Activity activity) {
        p.i(activity, "activity");
        return h6(activity, "screencapture_grant", "PROJECT_MEDIA", 2131887326, false, false, true, 48, null);
    }

    public static final ti.r<t7<io>> X6(Activity activity, go goVar, String str, List<? extends io> list, boolean z) {
        p.i(activity, "activity");
        return L6(activity, 2131887421, goVar, str, list, z);
    }

    public static final String X7() {
        return "DialogMessage";
    }

    public static final ti.r Y1(Activity activity, com.joaomgcd.taskerm.util.e0 e0Var, com.joaomgcd.taskerm.util.e0 e0Var2, com.joaomgcd.taskerm.util.e0 e0Var3, com.joaomgcd.taskerm.util.e0 e0Var4, com.joaomgcd.taskerm.util.e0 e0Var5) {
        return w7(new r(activity, e0Var, e0Var2, e0Var3, e0Var4, e0Var5, false, 0, null, 0, null, null, null, 8128, null));
    }

    public static final String Y2(l lVar, Object obj) {
        p.i(obj, "p0");
        return (String) lVar.invoke(obj);
    }

    public static final ti.r<p1> Y3(Activity activity, int i, int i2, int i3, boolean z, String str) {
        p.i(activity, "activity");
        return w7(new r(activity, i, i2, 2131886894, 2131886870, i3, z, 0, str, 0, (Integer) null, 1664, (h) null));
    }

    public static final String Y4(t7 t7Var) {
        p.i(t7Var, "dialogResult");
        Locale locale = (Locale) t7Var.c();
        if (locale != null) {
            String str = locale.getLanguage() + "-" + locale.getCountry();
            if (str != null) {
                return str;
            }
        }
        throw new RuntimeException("No language selected");
    }

    public static final ti.r<p1> Y5(final Activity activity) {
        p.i(activity, "activity");
        ti.r<p1> e4 = e4(activity, 2131886535, 2131887327);
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                ti.v Z5;
                Z5 = com.joaomgcd.taskerm.dialog.a.Z5(activity, (p1) obj);
                return Z5;
            }
        };
        ti.r<p1> t = e4.t(new yi.e() {
            public final Object a(Object obj) {
                ti.v a6;
                a6 = com.joaomgcd.taskerm.dialog.a.a6(lVar, obj);
                return a6;
            }
        });
        p.h(t, "flatMap(...)");
        return t;
    }

    public static ti.r Y6(Activity activity, go goVar, String str, List list, boolean z, int i, Object obj) {
        if ((i & 4) != 0) {
            str = null;
        }
        if ((i & 8) != 0) {
            list = goVar != null ? goVar.j() : null;
        }
        if ((i & 16) != 0) {
            z = false;
        }
        return X6(activity, goVar, str, list, z);
    }

    public static final Object Y7(Class<?> cls, Activity activity, String str, int i, String str2, String str3) {
        String str4;
        Integer t;
        Class<?> cls2 = cls;
        String str5 = str2;
        p.i(activity, "activity");
        p.i(str, "methodName");
        int i2 = i + 1;
        String str6 = "Parameter " + i2;
        if (str3 == null) {
            str4 = l7.a0(str) + ": " + str6;
        } else {
            str4 = str3;
        }
        if (p.d(cls2, String.class) || p.d(cls2, String[].class)) {
            String lowerCase = str4.toLowerCase(Locale.ROOT);
            p.h(lowerCase, "toLowerCase(...)");
            if (q.U(lowerCase, "package", false, 2, (Object) null)) {
                cls2 = AppBasic.class;
            }
        }
        if (p.d(cls2, int[].class)) {
            cls2 = Integer.TYPE;
        } else if (p.d(cls2, long[].class)) {
            cls2 = Long.TYPE;
        } else if (p.d(cls2, float[].class)) {
            cls2 = Float.TYPE;
        }
        if (p.d(cls2, List.class) || p.d(cls2, Object[].class)) {
            String str7 = (String) W2(activity, l7.C(str4), l7.C(b7.j6(2131887693, activity, new Object[]{str5 != null ? str5 : ""})), null, null, null, null, 120, null).f();
            if (str7 != null) {
                return str7;
            }
            throw new RuntimeException("No values entered for parameter " + i2);
        }
        if (p.d(cls2, Boolean.class) || p.d(cls2, Boolean.TYPE)) {
            return Boolean.valueOf(((p1) E7(activity, str4, str5, 2131886870).f()).o());
        }
        if (p.d(cls2, Integer.TYPE) || p.d(cls2, Integer.class) || p.d(cls2, Long.TYPE) || p.d(cls2, Long.class)) {
            if (str5 == null) {
                str5 = b7.j6(2131887931, activity, new Object[]{str6});
            }
            String c2 = ((p1) w7(new r(activity, str4, null, 0, 0, 0, true, 0, str5, 2, null, null, 3256, null)).f()).c();
            if (c2 != null && (t = q.t(c2)) != null) {
                return t;
            }
            throw new RuntimeException("No number entered for parameter " + i2);
        }
        if (p.d(cls2, String.class) || p.d(cls2, CharSequence.class)) {
            String c3 = ((p1) w7(new r(activity, str4, null, 0, 0, 0, true, 0, str2, 0, null, null, 3768, null)).f()).c();
            if (c3 != null) {
                return c3;
            }
            throw new RuntimeException("No text entered for parameter " + i2);
        }
        if (p.d(cls2, AppBasic.class)) {
            String str8 = (String) ((we) q6(activity, null, null, false, null, 30, null).f()).d();
            if (str8 != null) {
                return str8;
            }
            throw new RuntimeException("No app selected for parameter " + i2);
        }
        if (!p.d(cls2, Bitmap.class)) {
            return "";
        }
        Object f2 = G6(activity, false, false, false, false, false, false, true, null, null, 894, null).f();
        p.h(f2, "blockingGet(...)");
        String str9 = (String) n.R((Object[]) f2);
        if (str9 != null) {
            return str9;
        }
        throw new RuntimeException("No app selected for parameter " + i2);
    }

    public static final ti.r<String> Z1(final com.joaomgcd.taskerm.helper.h<?> hVar, final int i, final String str, final boolean z, final z zVar) {
        p.i(hVar, "helper");
        p.i(str, "host");
        if (z && !p5.p(hVar.q1(), Boolean.TRUE) && !ch.b.f()) {
            ti.r<String> r = ti.r.r(new RuntimeException(b7.j6(2131890678, hVar.q1(), new Object[0])));
            p.h(r, "error(...)");
            return r;
        }
        ti.r I = ExtensionsContextKt.M4(hVar.q1(), 375).I(Boolean.TRUE);
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                ti.v b2;
                b2 = com.joaomgcd.taskerm.dialog.a.b2(ne.z.this, hVar, (Boolean) obj);
                return b2;
            }
        };
        ti.r t = I.t(new yi.e() {
            public final Object a(Object obj) {
                ti.v d2;
                d2 = com.joaomgcd.taskerm.dialog.a.d2(lVar, obj);
                return d2;
            }
        });
        final l lVar2 = new l() {
            public final Object invoke(Object obj) {
                ti.v e2;
                e2 = com.joaomgcd.taskerm.dialog.a.e2(hVar, i, str, z, (t7) obj);
                return e2;
            }
        };
        ti.r t2 = t.t(new yi.e() {
            public final Object a(Object obj) {
                ti.v f2;
                f2 = com.joaomgcd.taskerm.dialog.a.f2(lVar2, obj);
                return f2;
            }
        });
        final l lVar3 = new l() {
            public final Object invoke(Object obj) {
                vj.e0 g2;
                g2 = com.joaomgcd.taskerm.dialog.a.g2(hVar, (String) obj);
                return g2;
            }
        };
        ti.r<String> q = t2.q(new yi.d() {
            public final void accept(Object obj) {
                com.joaomgcd.taskerm.dialog.a.i2(lVar3, obj);
            }
        });
        p.h(q, "doOnSuccess(...)");
        return q;
    }

    public static final ti.r<Boolean> Z2(Activity activity) {
        p.i(activity, "activity");
        h0 h0Var = new h0(activity, 2131888322, new Object[0]);
        h0 h0Var2 = new h0(activity, 2131888323, new Object[0]);
        h0 h0Var3 = new h0(activity, 2131890247, new Object[0]);
        h0 h0Var4 = new h0(activity, 2131887452, new Object[0]);
        g0 g0Var = new g0("PREF_ALLOW_INSECURE_TASK_RUN_REQUESTS");
        h0 h0Var5 = new h0(activity, 2131886228, new Object[0]);
        SharedPreferences R0 = pp.R0(activity);
        p.h(R0, "getMyPrefs(...)");
        ti.r<p1> U1 = U1(activity, h0Var, h0Var2, h0Var3, h0Var4, g0Var, h0Var5, R0);
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                Boolean a3;
                a3 = com.joaomgcd.taskerm.dialog.a.a3((p1) obj);
                return a3;
            }
        };
        ti.r<Boolean> x = U1.x(new yi.e() {
            public final Object a(Object obj) {
                Boolean b3;
                b3 = com.joaomgcd.taskerm.dialog.a.b3(lVar, obj);
                return b3;
            }
        });
        p.h(x, "map(...)");
        return x;
    }

    public static final ti.r<p1> Z3(Activity activity, int i, String str, int i2, boolean z, String str2) {
        p.i(activity, "activity");
        return w7(new r(activity, i, str, 2131886894, 2131886870, i2, z, 0, str2, 0, (Integer) null, 1664, (h) null));
    }

    public static final String Z4(l lVar, Object obj) {
        p.i(obj, "p0");
        return (String) lVar.invoke(obj);
    }

    public static final v Z5(Activity activity, p1 p1Var) {
        p.i(p1Var, "it");
        return !p1Var.o() ? ti.r.w(p1Var) : X5(activity);
    }

    public static final ti.r<t7<pi>> Z6(Activity activity, go goVar, String str, List<? extends pi> list, boolean z) {
        p.i(activity, "activity");
        return L6(activity, 2131890330, goVar, str, list, z);
    }

    public static ti.r a2(com.joaomgcd.taskerm.helper.h hVar, int i, String str, boolean z, z zVar, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            i = d1.n(hVar.q1());
        }
        if ((i2 & 4) != 0) {
            str = "localhost";
        }
        if ((i2 & 8) != 0) {
            z = false;
        }
        if ((i2 & 16) != 0) {
            zVar = null;
        }
        return Z1(hVar, i, str, z, zVar);
    }

    public static final Boolean a3(p1 p1Var) {
        p.i(p1Var, "dialogMessage");
        return Boolean.valueOf(p1Var.o() || p1Var.n());
    }

    public static final ti.r<p1> a4(Activity activity, String str, String str2, int i, boolean z, String str3, Integer num, int i2, Integer num2, List<String> list) {
        p.i(activity, "activity");
        p.i(str, "title");
        return w7(new r(activity, str, str2, 2131886894, 2131886870, i, z, num != null ? num.intValue() | W7(z) : W7(z), str3, i2, num2, list));
    }

    public static final ti.r<String> a5(final Activity activity) {
        p.i(activity, "activity");
        return e2.y1(new ik.a() {
            public final Object e() {
                String b5;
                b5 = com.joaomgcd.taskerm.dialog.a.b5(activity);
                return b5;
            }
        });
    }

    public static final v a6(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    public static ti.r a7(Activity activity, go goVar, String str, List list, boolean z, int i, Object obj) {
        if ((i & 4) != 0) {
            str = null;
        }
        if ((i & 8) != 0) {
            list = goVar != null ? goVar.e() : null;
        }
        if ((i & 16) != 0) {
            z = false;
        }
        return Z6(activity, goVar, str, list, z);
    }

    public static final ti.r<p1> a8(l<? super x7<sj.d<p1>>, e0> lVar, l<? super p1, Boolean> lVar2) {
        p.i(lVar, "block");
        return b8(lVar, lVar2, new l() {
            public final Object invoke(Object obj) {
                p1 d82;
                d82 = com.joaomgcd.taskerm.dialog.a.d8((Message) obj);
                return d82;
            }
        });
    }

    public static final v b2(z zVar, final com.joaomgcd.taskerm.helper.h hVar, Boolean bool) {
        p.i(bool, "it");
        if (zVar == null) {
            return x0.c0(new s7(hVar.q1(), 2131889530, (List) z.a.a(), true, new l() {
                public final Object invoke(Object obj) {
                    o1 c2;
                    c2 = com.joaomgcd.taskerm.dialog.a.c2(hVar, (ne.z) obj);
                    return c2;
                }
            }, (Integer) null, (l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 65504, (h) null));
        }
        ti.r w = ti.r.w(new t7(new df.j7(null, null, 3, null), zVar, null, 4, null));
        p.h(w, "just(...)");
        return w;
    }

    public static final Boolean b3(l lVar, Object obj) {
        p.i(obj, "p0");
        return (Boolean) lVar.invoke(obj);
    }

    public static ti.r b4(Activity activity, int i, int i2, int i3, boolean z, String str, int i4, Object obj) {
        if ((i4 & 8) != 0) {
            i3 = -1;
        }
        int i5 = i3;
        if ((i4 & 16) != 0) {
            z = false;
        }
        boolean z2 = z;
        if ((i4 & 32) != 0) {
            str = null;
        }
        return Y3(activity, i, i2, i5, z2, str);
    }

    public static final String b5(Activity activity) {
        MatterDevices H = gd.u.H(activity);
        if (H.isEmpty()) {
            p1 p1Var = (p1) V3(activity, b7.j6(2131887001, activity, new Object[0]), b7.j6(2131888251, activity, new Object[0]), b7.a6(2131891082, activity), b7.a6(2131886174, activity)).f();
            if (p1Var.k()) {
                ExtensionsContextKt.e0(activity, "https://youtube.com/shorts/y1fCUgTc6Wc", false, false, false, 14, (Object) null);
                throw new RuntimeException("Watching tutorial");
            }
            if (p1Var.n()) {
                gd.u.w(activity);
                throw new RuntimeException(b7.j6(2131886181, activity, new Object[0]));
            }
        }
        t7 t7Var = (t7) x0.c0(new s7(activity, 2131889576, (List) H, false, new l() {
            public final Object invoke(Object obj) {
                o1 c5;
                c5 = com.joaomgcd.taskerm.dialog.a.c5((MatterDevice) obj);
                return c5;
            }
        }, (Integer) 2131890910, (l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) b7.a6(2131886173, activity), (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 63432, (h) null)).f();
        if (t7Var.a().o()) {
            gd.u.w(activity);
            throw new RuntimeException(b7.j6(2131886181, activity, new Object[0]));
        }
        MatterDevice matterDevice = (MatterDevice) t7Var.c();
        if (matterDevice == null) {
            throw new RuntimeException("No device selected");
        }
        if (!t7Var.a().r()) {
            return ((p1) S1(activity, b7.a6(2131889225, activity), b7.a6(2131891088, activity), b7.a6(2131889804, activity), b7.a6(2131889679, activity)).f()).k() ? String.valueOf(matterDevice.getId()) : matterDevice.getName();
        }
        l7.e1(b7.j6(2131888723, activity, new Object[0]), activity);
        p4(activity, 2131887001, 2131887176, 0, 0, null, 56, null).f();
        gd.u.z(activity, matterDevice);
        Object f2 = a5(activity).f();
        p.h(f2, "blockingGet(...)");
        return (String) f2;
    }

    public static final ti.r<pe> b6(final Activity activity, final f1 f1Var, final boolean z) {
        p.i(activity, "activity");
        p.i(f1Var, "selectedSecureSettingType");
        return e2.y1(new ik.a() {
            public final Object e() {
                pe c6;
                c6 = com.joaomgcd.taskerm.dialog.a.c6(activity, z, f1Var);
                return c6;
            }
        });
    }

    public static final ti.r<t7<mj>> b7(Activity activity, go goVar, String str, List<? extends mj> list, boolean z) {
        p.i(activity, "activity");
        return L6(activity, 2131887549, goVar, str, list, z);
    }

    public static final <TDialogMessage extends p1> ti.r<TDialogMessage> b8(final l<? super x7<sj.d<TDialogMessage>>, e0> lVar, final l<? super TDialogMessage, Boolean> lVar2, final l<? super Message, ? extends TDialogMessage> lVar3) {
        p.i(lVar, "block");
        p.i(lVar3, "getDialogMessage");
        return e2.u1(new ik.a() {
            public final Object e() {
                ti.r e82;
                e82 = com.joaomgcd.taskerm.dialog.a.e8(lVar, lVar3, lVar2);
                return e82;
            }
        });
    }

    public static final o1 c2(com.joaomgcd.taskerm.helper.h hVar, z zVar) {
        p.i(zVar, "it");
        return new o1(zVar.getName().a(hVar.q1()), null, false, 6, null);
    }

    public static final ti.r<p1> c3(Activity activity) {
        p.i(activity, "activity");
        return R3(activity, 2131888322, 2131888333);
    }

    public static ti.r c4(Activity activity, int i, String str, int i2, boolean z, String str2, int i3, Object obj) {
        if ((i3 & 8) != 0) {
            i2 = -1;
        }
        int i4 = i2;
        if ((i3 & 16) != 0) {
            z = false;
        }
        boolean z2 = z;
        if ((i3 & 32) != 0) {
            str2 = null;
        }
        return Z3(activity, i, str, i4, z2, str2);
    }

    public static final o1 c5(MatterDevice matterDevice) {
        p.i(matterDevice, "it");
        return new o1(matterDevice.getName() + " (ID: " + matterDevice.getId() + ")", null, false, 6, null);
    }

    public static final pe c6(Activity activity, boolean z, f1 f1Var) {
        b3 b3Var = a;
        if (b3Var == null) {
            if (((p1) w7(new r(activity, 2131887423, 2131887366, 2131888875, 2131887423, 0, false, 0, (String) null, 0, (Integer) null, 2016, (h) null)).f()).k()) {
                h1 h1Var = (h1) ((t7) x0.c0(new s7(activity, 2131887423, (List) d6(activity, f1Var, true), false, (l) null, (Integer) null, (l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 65528, (h) null)).f()).c();
                return h1Var == null ? new se("no setting selected") : new ve(h1Var);
            }
            a = e6(activity, f1Var, false, 4, null);
            w7(new r(activity, 2131887423, 2131887295, 0, 0, 0, false, 0, (String) null, 0, (Integer) null, 2040, (h) null)).f();
            return new ue();
        }
        a = null;
        c3 c3Var = (c3) e6(activity, f1Var, false, 4, null).x(b3Var).f();
        if (c3Var.size() == 0) {
            w7(new r(activity, 2131887423, 2131889265, 0, 0, 0, false, 0, (String) null, 0, (Integer) null, 2040, (h) null)).f();
            return new se("no differences found");
        }
        p.f(c3Var);
        i1 i1Var = (i1) ((t7) x0.c0(new s7(activity, 2131887423, (List) c3Var, false, (l) null, (Integer) null, (l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 65528, (h) null)).f()).c();
        if (i1Var == null) {
            return new se("no setting selected");
        }
        if (z && i1Var.b().h() && i1Var.a().h() && ((p1) N7(activity, 2131887423, 2131887241, 0, 8, null).f()).o()) {
            i1Var.a().j(g2.a);
        }
        return new ve(i1Var.a());
    }

    public static ti.r c7(Activity activity, go goVar, String str, List list, boolean z, int i, Object obj) {
        if ((i & 4) != 0) {
            str = null;
        }
        if ((i & 8) != 0) {
            list = goVar != null ? goVar.a(-2, mj.i.r, false) : null;
        }
        if ((i & 16) != 0) {
            z = false;
        }
        return b7(activity, goVar, str, list, z);
    }

    public static ti.r c8(l lVar, l lVar2, int i, Object obj) {
        if ((i & 2) != 0) {
            lVar2 = null;
        }
        return a8(lVar, lVar2);
    }

    public static final v d2(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    public static final ti.r<p1> d3(Activity activity) {
        p.i(activity, "activity");
        if (!com.joaomgcd.taskerm.util.r.a.p()) {
            return h6(activity, "media_key_listener_grant", "android.permission.SET_MEDIA_KEY_LISTENER", 2131887257, false, false, false, 112, null);
        }
        ti.r<p1> w = ti.r.w(new p1(0, null, 2, null));
        p.h(w, "just(...)");
        return w;
    }

    public static ti.r d4(Activity activity, String str, String str2, int i, boolean z, String str3, Integer num, int i2, Integer num2, List list, int i3, Object obj) {
        return a4(activity, str, str2, (i3 & 8) != 0 ? -1 : i, (i3 & 16) != 0 ? false : z, (i3 & 32) != 0 ? null : str3, (i3 & 64) != 0 ? null : num, (i3 & 128) != 0 ? 0 : i2, (i3 & 256) != 0 ? Integer.valueOf(fp.X(activity)) : num2, (i3 & 512) != 0 ? null : list);
    }

    public static final ti.r<Pair<Integer, pi>> d5(Activity activity, fo foVar, int i, List<? extends pi> list) {
        p.i(activity, "context");
        p.i(foVar, "taskerData");
        p.i(list, "projects");
        int m = d1.m(activity);
        ti.r c0 = x0.c0(new s7(activity, i, (List) list, false, new l() {
            public final Object invoke(Object obj) {
                o1 f5;
                f5 = com.joaomgcd.taskerm.dialog.a.f5((pi) obj);
                return f5;
            }
        }, (Integer) null, (l) null, Boolean.TRUE, (Boolean) null, Integer.valueOf(fp.X(activity)), Integer.valueOf(m), (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 63840, (h) null));
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                Pair g5;
                g5 = com.joaomgcd.taskerm.dialog.a.g5((t7) obj);
                return g5;
            }
        };
        ti.r<Pair<Integer, pi>> x = c0.x(new yi.e() {
            public final Object a(Object obj) {
                Pair h5;
                h5 = com.joaomgcd.taskerm.dialog.a.h5(lVar, obj);
                return h5;
            }
        });
        p.h(x, "map(...)");
        return x;
    }

    private static final b3 d6(Activity activity, f1 f1Var, boolean z) {
        com.joaomgcd.taskerm.dialog.b g = b.a.g(com.joaomgcd.taskerm.dialog.b.c, activity, 2131887204, false, 4, null);
        b3.a aVar = b3.i;
        if (!z) {
            f1Var = null;
        }
        b3 b3Var = (b3) aVar.d(activity, f1Var).f();
        com.joaomgcd.taskerm.dialog.b.h(g, null, 1, null);
        p.f(b3Var);
        return b3Var;
    }

    public static final ti.r<t7<fn>> d7(Activity activity, go goVar, String str, List<? extends fn> list, boolean z) {
        p.i(activity, "activity");
        return L6(activity, 2131890750, goVar, str, list, z);
    }

    public static final p1 d8(Message message) {
        p.i(message, "it");
        return new p1(message);
    }

    public static final v e2(com.joaomgcd.taskerm.helper.h hVar, int i, String str, boolean z, t7 t7Var) {
        p.i(t7Var, "it");
        z zVar = (z) t7Var.c();
        if (zVar != null) {
            return zVar.a(hVar.q1(), i, str, z, true, hVar.S());
        }
        throw new RuntimeException("No command type selected");
    }

    public static final ti.r<p1> e3(Activity activity, int i) {
        p.i(activity, "activity");
        return w7(new r(activity, 2131891107, com.joaomgcd.taskerm.util.r.a.f(activity, i), 0, 0, 0, false, 0, (String) null, 0, (Integer) null, 2040, (h) null));
    }

    public static final ti.r<p1> e4(final Activity activity, final int i, final int i2) {
        p.i(activity, "activity");
        return rg.i.i(activity, new h0(activity, i2, new Object[0]), new ik.a() {
            public final Object e() {
                ti.r j4;
                j4 = com.joaomgcd.taskerm.dialog.a.j4();
                return j4;
            }
        }, new l() {
            public final Object invoke(Object obj) {
                boolean k4;
                k4 = com.joaomgcd.taskerm.dialog.a.k4((p1) obj);
                return Boolean.valueOf(k4);
            }
        }, (SharedPreferences) null, new ik.a() {
            public final Object e() {
                ti.r l4;
                l4 = com.joaomgcd.taskerm.dialog.a.l4(activity, i, i2);
                return l4;
            }
        }, 8, (Object) null);
    }

    public static ti.r e5(Activity activity, fo foVar, int i, List list, int i2, Object obj) {
        if ((i2 & 8) != 0) {
            List z2 = foVar.z2();
            p.h(z2, "getProjects(...)");
            list = t.O0(z2);
        }
        return d5(activity, foVar, i, list);
    }

    static b3 e6(Activity activity, f1 f1Var, boolean z, int i, Object obj) {
        if ((i & 4) != 0) {
            z = false;
        }
        return d6(activity, f1Var, z);
    }

    public static ti.r e7(Activity activity, go goVar, String str, List list, boolean z, int i, Object obj) {
        if ((i & 4) != 0) {
            str = null;
        }
        if ((i & 8) != 0) {
            list = goVar != null ? goVar.K(-2, fn.f.r) : null;
        }
        if ((i & 16) != 0) {
            z = false;
        }
        return d7(activity, goVar, str, list, z);
    }

    public static final ti.r e8(l lVar, final l lVar2, final l lVar3) {
        sj.d V = sj.d.V();
        p.h(V, "create(...)");
        lVar.invoke(new x7(V, new ik.p() {
            public final Object n(Object obj, Object obj2) {
                vj.e0 f82;
                f82 = com.joaomgcd.taskerm.dialog.a.f8(lVar2, lVar3, (sj.d) obj, (Message) obj2);
                return f82;
            }
        }));
        return V;
    }

    public static final v f2(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    public static final ti.r<pe> f3(final Activity activity, final se seVar) {
        p.i(activity, "activity");
        p.i(seVar, "error");
        if (ac.a.r(ac.f, activity, 0, 2, (Object) null).i0()) {
            ti.r<pe> w = ti.r.w(new ue());
            p.h(w, "just(...)");
            return w;
        }
        ti.r<p1> w72 = w7(new r(activity, 2131887507, b7.j6(2131886742, activity, new Object[0]), 2131886894, 2131886892, 0, false, 0, (String) null, 0, (Integer) null, 2016, (h) null));
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                ti.v h3;
                h3 = com.joaomgcd.taskerm.dialog.a.h3(activity, seVar, (p1) obj);
                return h3;
            }
        };
        ti.r<pe> t = w72.t(new yi.e() {
            public final Object a(Object obj) {
                ti.v i3;
                i3 = com.joaomgcd.taskerm.dialog.a.i3(lVar, obj);
                return i3;
            }
        });
        p.h(t, "flatMap(...)");
        return t;
    }

    public static final ti.r<p1> f4(final Activity activity, final int i, final String str) {
        p.i(activity, "activity");
        p.i(str, "text");
        return rg.i.i(activity, new g0(str), new ik.a() {
            public final Object e() {
                ti.r g4;
                g4 = com.joaomgcd.taskerm.dialog.a.g4();
                return g4;
            }
        }, new l() {
            public final Object invoke(Object obj) {
                boolean h4;
                h4 = com.joaomgcd.taskerm.dialog.a.h4((p1) obj);
                return Boolean.valueOf(h4);
            }
        }, (SharedPreferences) null, new ik.a() {
            public final Object e() {
                ti.r i4;
                i4 = com.joaomgcd.taskerm.dialog.a.i4(activity, i, str);
                return i4;
            }
        }, 8, (Object) null);
    }

    public static final o1 f5(pi piVar) {
        p.i(piVar, "project");
        String name = piVar.getName();
        p.h(name, "getName(...)");
        return new o1(name, piVar.getIcon(), false, 4, null);
    }

    public static final ti.r<p1> f6(Activity activity, String str, String str2, int i, boolean z, boolean z2, boolean z3) {
        p.i(activity, "activity");
        p.i(str, "helpId");
        p.i(str2, "permission");
        return g6(activity, str, str2, b7.j6(i, activity, new Object[0]), z, z2, z3);
    }

    public static final ti.r<String> f7(Activity activity, List<String> list) {
        p.i(activity, "activity");
        p.i(list, "dataVars");
        ti.r c0 = x0.c0(new s7(activity, 2131887427, (List) list, false, new l() {
            public final Object invoke(Object obj) {
                o1 g72;
                g72 = com.joaomgcd.taskerm.dialog.a.g7((String) obj);
                return g72;
            }
        }, (Integer) null, (l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 65504, (h) null));
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                String h72;
                h72 = com.joaomgcd.taskerm.dialog.a.h7((t7) obj);
                return h72;
            }
        };
        ti.r<String> x = c0.x(new yi.e() {
            public final Object a(Object obj) {
                String i72;
                i72 = com.joaomgcd.taskerm.dialog.a.i7(lVar, obj);
                return i72;
            }
        });
        p.h(x, "map(...)");
        return x;
    }

    public static final e0 f8(l lVar, l lVar2, sj.d dVar, Message message) {
        p.i(dVar, "singleSubject");
        p.i(message, "message");
        p1 p1Var = (p1) lVar.invoke(message);
        if (lVar2 != null && ((Boolean) lVar2.invoke(p1Var)).booleanValue()) {
            return e0.a;
        }
        dVar.b(p1Var);
        return e0.a;
    }

    public static final e0 g2(com.joaomgcd.taskerm.helper.h hVar, String str) {
        e2.D2(z7(hVar.q1(), 2131890854), hVar.q1(), new yi.d() {
            public final void accept(Object obj) {
                com.joaomgcd.taskerm.dialog.a.h2((p1) obj);
            }
        });
        return e0.a;
    }

    public static ti.r g3(Activity activity, se seVar, int i, Object obj) {
        if ((i & 2) != 0) {
            seVar = ac.f.T(activity);
        }
        return f3(activity, seVar);
    }

    public static final ti.r g4() {
        ti.r w = ti.r.w(new p1(1, null, 2, null));
        p.h(w, "just(...)");
        return w;
    }

    public static final Pair g5(t7 t7Var) {
        p.i(t7Var, "it");
        Integer b2 = t7Var.b();
        if (b2 == null) {
            throw new RuntimeException("No project selected");
        }
        pi piVar = (pi) t7Var.c();
        if (piVar != null) {
            return new Pair(b2, piVar);
        }
        throw new RuntimeException("No project selected");
    }

    public static final ti.r<p1> g6(final Activity activity, final String str, final String str2, String str3, final boolean z, final boolean z2, final boolean z3) {
        p.i(activity, "activity");
        p.i(str, "helpId");
        p.i(str2, "permission");
        p.i(str3, "dialogMessage");
        ti.r<p1> w72 = w7(new r(activity, 2131887507, str3, 2131886894, 2131886892, 0, false, 0, (String) null, 0, (Integer) null, 2016, (h) null));
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                ti.v j6;
                j6 = com.joaomgcd.taskerm.dialog.a.j6(activity, z2, z3, str2, z, str, (p1) obj);
                return j6;
            }
        };
        ti.r<p1> t = w72.t(new yi.e() {
            public final Object a(Object obj) {
                ti.v o62;
                o62 = com.joaomgcd.taskerm.dialog.a.o6(lVar, obj);
                return o62;
            }
        });
        p.h(t, "flatMap(...)");
        return t;
    }

    public static final o1 g7(String str) {
        p.i(str, "it");
        return new o1(str, null, false, 6, null);
    }

    public static final v h3(Activity activity, se seVar, p1 p1Var) {
        p.i(p1Var, "it");
        if (p1Var.o()) {
            return new GenericActionActivityRequestMissingPermissions(new String[]{"android.permission.BODY_SENSORS_BACKGROUND"}, (String) null, 2, (h) null).run(activity);
        }
        ti.r w = ti.r.w(seVar);
        p.f(w);
        return w;
    }

    public static final boolean h4(p1 p1Var) {
        p.i(p1Var, "it");
        return p1Var.n();
    }

    public static final Pair h5(l lVar, Object obj) {
        p.i(obj, "p0");
        return (Pair) lVar.invoke(obj);
    }

    public static ti.r h6(Activity activity, String str, String str2, int i, boolean z, boolean z2, boolean z3, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            str = "secure_setting_grant";
        }
        if ((i2 & 4) != 0) {
            str2 = "android.permission.WRITE_SECURE_SETTINGS";
        }
        String str3 = str2;
        if ((i2 & 8) != 0) {
            i = 2131887330;
        }
        int i3 = i;
        boolean z4 = (i2 & 16) != 0 ? false : z;
        if ((i2 & 32) != 0) {
            z2 = true;
        }
        return f6(activity, str, str3, i3, z4, z2, (i2 & 64) != 0 ? false : z3);
    }

    public static final String h7(t7 t7Var) {
        p.i(t7Var, "it");
        String str = (String) t7Var.c();
        if (str != null) {
            return !q.O(str, "%", false, 2, (Object) null) ? ji.r(str) : str;
        }
        throw new RuntimeException("No variable selected");
    }

    public static final void i2(l lVar, Object obj) {
        lVar.invoke(obj);
    }

    public static final v i3(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    public static final ti.r i4(Activity activity, int i, String str) {
        return c4(activity, i, str, 2131886905, false, null, 48, null);
    }

    public static final java.lang.Object i5(android.app.Activity r29, zj.e<? super java.lang.String> r30) {
        throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.taskerm.dialog.a.i5(android.app.Activity, zj.e):java.lang.Object");
    }

    public static ti.r i6(Activity activity, String str, String str2, String str3, boolean z, boolean z2, boolean z3, int i, Object obj) {
        if ((i & 2) != 0) {
            str = "secure_setting_grant";
        }
        String str4 = str;
        if ((i & 4) != 0) {
            str2 = "android.permission.WRITE_SECURE_SETTINGS";
        }
        String str5 = str2;
        boolean z4 = (i & 16) != 0 ? false : z;
        if ((i & 32) != 0) {
            z2 = true;
        }
        return g6(activity, str4, str5, str3, z4, z2, (i & 64) != 0 ? false : z3);
    }

    public static final String i7(l lVar, Object obj) {
        p.i(obj, "p0");
        return (String) lVar.invoke(obj);
    }

    public static final ti.r<p1> j2(final Activity activity) {
        p.i(activity, "activity");
        ti.r w = p5.w();
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                ti.v k2;
                k2 = com.joaomgcd.taskerm.dialog.a.k2(activity, (Boolean) obj);
                return k2;
            }
        };
        ti.r<p1> t = w.t(new yi.e() {
            public final Object a(Object obj) {
                ti.v l2;
                l2 = com.joaomgcd.taskerm.dialog.a.l2(lVar, obj);
                return l2;
            }
        });
        p.h(t, "flatMap(...)");
        return t;
    }

    public static final ti.r<pe> j3(final Activity activity, final se seVar) {
        p.i(activity, "activity");
        p.i(seVar, "error");
        if (ac.a.F1(ac.f, activity, 0, 2, (Object) null).i0()) {
            ti.r<pe> w = ti.r.w(new ue());
            p.h(w, "just(...)");
            return w;
        }
        ti.r<p1> w72 = w7(new r(activity, 2131887507, b7.j6(2131886745, activity, new Object[0]), 2131886894, 2131886892, 0, false, 0, (String) null, 0, (Integer) null, 2016, (h) null));
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                ti.v l3;
                l3 = com.joaomgcd.taskerm.dialog.a.l3(activity, seVar, (p1) obj);
                return l3;
            }
        };
        ti.r<pe> t = w72.t(new yi.e() {
            public final Object a(Object obj) {
                ti.v m3;
                m3 = com.joaomgcd.taskerm.dialog.a.m3(lVar, obj);
                return m3;
            }
        });
        p.h(t, "flatMap(...)");
        return t;
    }

    public static final ti.r j4() {
        ti.r w = ti.r.w(new p1(1, null, 2, null));
        p.h(w, "just(...)");
        return w;
    }

    private static final h0 j5(int i, Activity activity) {
        return b7.a6(i, activity);
    }

    public static final v j6(final Activity activity, final boolean z, final boolean z2, final String str, final boolean z3, final String str2, p1 p1Var) {
        p.i(p1Var, "it");
        return p1Var.o() ? e2.y1(new ik.a() {
            public final Object e() {
                p1 k6;
                k6 = com.joaomgcd.taskerm.dialog.a.k6(activity, z, z2, str, z3, str2);
                return k6;
            }
        }) : ti.r.w(p1Var);
    }

    public static final ti.r<r1> j7(final Activity activity, final Sensor sensor, final String str) {
        p.i(activity, "activity");
        p.i(sensor, "sensor");
        p.i(str, "variableName");
        ExtensionsContextKt.m4(activity, true);
        return e2.y1(new ik.a() {
            public final Object e() {
                net.dinglisch.android.taskerm.r1 k72;
                k72 = com.joaomgcd.taskerm.dialog.a.k7(activity, sensor, str);
                return k72;
            }
        });
    }

    public static final v k2(Activity activity, Boolean bool) {
        p.i(bool, "isRootGiven");
        return bool.booleanValue() ? p4(activity, 2131886234, 2131887123, 0, 0, null, 56, null) : i6(activity, "adb_wifi", "android.permission.ADB_WIFI", b7.j6(2131887122, activity, new Object[]{ExtensionsContextKt.Q0(activity)}), false, false, false, 80, null);
    }

    public static ti.r k3(Activity activity, se seVar, int i, Object obj) {
        if ((i & 2) != 0) {
            seVar = ac.f.T(activity);
        }
        return j3(activity, seVar);
    }

    public static final boolean k4(p1 p1Var) {
        p.i(p1Var, "it");
        return p1Var.n();
    }

    private static final g0 k5(String str) {
        return new g0(str);
    }

    public static final p1 k6(Activity activity, boolean z, boolean z2, String str, boolean z3, String str2) {
        String str3;
        Boolean bool = (Boolean) p5.r(activity).f();
        boolean f2 = ch.b.f();
        if (!z || (!bool.booleanValue() && !f2)) {
            return l6(activity, str2);
        }
        if (!((p1) w7(new r(activity, bool.booleanValue() ? 2131890062 : 2131890063, bool.booleanValue() ? 2131887334 : 2131887335, 2131886894, 2131886892, 0, false, 0, (String) null, 0, (Integer) null, 2016, (h) null)).f()).o()) {
            return l6(activity, str2);
        }
        if (z2) {
            str3 = "appops set " + activity.getPackageName() + " " + str + " allow";
        } else {
            str3 = "pm grant " + activity.getPackageName() + " " + str;
        }
        String str4 = str3;
        if (((md) (bool.booleanValue() ? oe.a.m(new n0(str4, true, 10000L, false, 8, (h) null)) : oe.a.t(oe.a, activity, (uk.n0) null, str4, 10000L, 2, (Object) null)).f()).g()) {
            w7(new r(activity, 2131886876, 2131887301, 2131886894, 0, 0, false, 0, (String) null, 0, (Integer) null, 2032, (h) null)).f();
        }
        if (z3) {
            R3(activity, 2131887535, 2131887317).f();
            oe.a.m(new n0("am force-stop " + activity.getPackageName(), true, 10000L, false, 8, (h) null)).f();
        }
        return new p1(0, null, 2, null);
    }

    public static final r1 k7(Activity activity, Sensor sensor, String str) {
        ?? r2;
        ?? r4;
        ?? r3;
        boolean z;
        Iterator it;
        SensorManager G2 = ExtensionsContextKt.G2(activity);
        if (G2 == null) {
            return new r1();
        }
        r8 b2 = s8.b("setup");
        try {
            if (b7.F4(sensor)) {
                r1 l72 = l7(activity, sensor, G2, b2, str);
                b2.h();
                ExtensionsContextKt.m4(activity, false);
                return l72;
            }
            j0 j0Var = new j0();
            try {
                j0Var.i = new r(activity, "", "", 0, 0, 0, false, 0, null, 0, null, null, 4088, null);
                ArrayList arrayList = new ArrayList();
                f fVar = new f(arrayList, 5, j0Var);
                com.joaomgcd.taskerm.dialog.b g = b.a.g(com.joaomgcd.taskerm.dialog.b.c, activity, 2131887203, false, 4, null);
                r4 = 2;
                r4 = 2;
                Sensor sensor2 = sensor;
                G2.registerListener(fVar, sensor2, 2, 200, b2.e());
                int i = 0;
                r3 = sensor2;
                do {
                    r2 = 0;
                    r2 = 0;
                    try {
                        try {
                            if (!arrayList.isEmpty()) {
                                com.joaomgcd.taskerm.dialog.b.h(g, null, 1, null);
                                try {
                                    r rVar = new r(activity, String.valueOf(sensor.getName()), n7((float[]) t.h0(arrayList, 0)), 0, 0, 0, false, 0, null, 0, null, null, 4088, null);
                                    j0Var.i = rVar;
                                    w7(rVar).f();
                                    G2.unregisterListener(fVar);
                                    if (arrayList.size() > 5) {
                                        r1 l73 = l7(activity, sensor, G2, b2, str);
                                        b2.h();
                                        ExtensionsContextKt.m4(activity, false);
                                        return l73;
                                    }
                                    ArrayList arrayList2 = new ArrayList(t.w(arrayList, 10));
                                    Iterator it2 = arrayList.iterator();
                                    while (it2.hasNext()) {
                                        float[] fArr = (float[]) it2.next();
                                        try {
                                            it = it2;
                                            z = false;
                                        } catch (Throwable th) {
                                            th = th;
                                            z = false;
                                            r3 = activity;
                                            r2 = z;
                                            r4 = b2;
                                            r4.h();
                                            ExtensionsContextKt.m4((Activity) r3, (boolean) r2);
                                            throw th;
                                        }
                                        try {
                                            arrayList2.add(new Pair(new q1(Expr.Op.Matches, m7(str, 0), n.k0(fArr, ",", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (l) null, 62, (Object) null)), r1.a.r));
                                            it2 = it;
                                        } catch (Throwable th2) {
                                            th = th2;
                                            r3 = activity;
                                            r2 = z;
                                            r4 = b2;
                                            r4.h();
                                            ExtensionsContextKt.m4((Activity) r3, (boolean) r2);
                                            throw th;
                                        }
                                    }
                                    z = false;
                                    ArrayList arrayList3 = new ArrayList(t.w(arrayList2, 10));
                                    Iterator it3 = arrayList2.iterator();
                                    while (it3.hasNext()) {
                                        arrayList3.add((q1) ((Pair) it3.next()).getFirst());
                                    }
                                    ArrayList arrayList4 = new ArrayList(t.w(arrayList2, 10));
                                    Iterator it4 = arrayList2.iterator();
                                    while (it4.hasNext()) {
                                        arrayList4.add((r1.a) ((Pair) it4.next()).getSecond());
                                    }
                                    r1 r1Var = new r1(arrayList3, arrayList4);
                                    b2.h();
                                    ExtensionsContextKt.m4(activity, false);
                                    return r1Var;
                                } catch (Throwable th3) {
                                    th = th3;
                                    r3 = activity;
                                    r2 = 0;
                                    r4 = b2;
                                    r4.h();
                                    ExtensionsContextKt.m4((Activity) r3, (boolean) r2);
                                    throw th;
                                }
                            }
                            bi.b0(100L);
                            i++;
                            r3 = 30;
                        } catch (Throwable th4) {
                            r3 = activity;
                            r4 = b2;
                            r2 = 0;
                            r2 = 0;
                            try {
                                l7.c1(th4.getMessage(), (Context) r3);
                                r1 r1Var2 = new r1();
                                r4.h();
                                ExtensionsContextKt.m4((Activity) r3, false);
                                return r1Var2;
                            } finally {
                                com.joaomgcd.taskerm.dialog.b.h(g, null, 1, null);
                            }
                        }
                    } catch (Throwable th5) {
                        th = th5;
                        r4.h();
                        ExtensionsContextKt.m4((Activity) r3, (boolean) r2);
                        throw th;
                    }
                } while (i <= 30);
                r3 = "Couldn't get sensor value";
                throw new RuntimeException("Couldn't get sensor value");
            } catch (Throwable th6) {
                th = th6;
                z = false;
            }
        } catch (Throwable th7) {
            th = th7;
            r2 = 0;
            r4 = b2;
            r3 = activity;
        }
    }

    public static final v l2(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    public static final v l3(Activity activity, se seVar, p1 p1Var) {
        p.i(p1Var, "it");
        if (p1Var.o()) {
            return new GenericActionActivityRequestMissingPermissions(new String[]{"android.permission.ACCESS_BACKGROUND_LOCATION"}, (String) null, 2, (h) null).run(activity);
        }
        ti.r w = ti.r.w(seVar);
        p.f(w);
        return w;
    }

    public static final ti.r l4(Activity activity, int i, int i2) {
        return b4(activity, i, i2, 2131886905, false, null, 48, null);
    }

    public static final ti.r<j8> l5(final Activity activity, boolean z) {
        p.i(activity, "activity");
        List F2 = ExtensionsContextKt.F2(activity);
        if (F2 == null) {
            ti.r<j8> r = ti.r.r(new RuntimeException("Device has no sensors"));
            p.h(r, "error(...)");
            return r;
        }
        ArrayList arrayList = new ArrayList();
        for (Object obj : F2) {
            Sensor sensor = (Sensor) obj;
            if (!z) {
                p.f(sensor);
                if (!b7.Q4(sensor)) {
                }
            }
            arrayList.add(obj);
        }
        ti.r c0 = x0.c0(new s7(activity, 2131887010, (List) arrayList, false, new l() {
            public final Object invoke(Object obj2) {
                o1 n5;
                n5 = com.joaomgcd.taskerm.dialog.a.n5((Sensor) obj2);
                return n5;
            }
        }, (Integer) 2131890964, new l() {
            public final Object invoke(Object obj2) {
                vj.e0 o5;
                o5 = com.joaomgcd.taskerm.dialog.a.o5(activity, (Sensor) obj2);
                return o5;
            }
        }, Boolean.TRUE, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 65288, (h) null));
        final l lVar = new l() {
            public final Object invoke(Object obj2) {
                ti.v q5;
                q5 = com.joaomgcd.taskerm.dialog.a.q5(activity, (t7) obj2);
                return q5;
            }
        };
        ti.r<j8> t = c0.t(new yi.e() {
            public final Object a(Object obj2) {
                ti.v s5;
                s5 = com.joaomgcd.taskerm.dialog.a.s5(lVar, obj2);
                return s5;
            }
        });
        p.h(t, "flatMap(...)");
        return t;
    }

    private static final p1 l6(Activity activity, String str) {
        ac J = ac.a.J(ac.f, activity, 0, 2, (Object) null);
        if (!J.h0()) {
            ti.r<p1> R3 = R3(activity, 2131887558, 2131887357);
            final l lVar = new l() {
                public final Object invoke(Object obj) {
                    ti.v m6;
                    m6 = com.joaomgcd.taskerm.dialog.a.m6((Throwable) obj);
                    return m6;
                }
            };
            R3.C(new yi.e() {
                public final Object a(Object obj) {
                    ti.v n62;
                    n62 = com.joaomgcd.taskerm.dialog.a.n6(lVar, obj);
                    return n62;
                }
            }).f();
        }
        if (!((pe) J.X(activity).f()).b()) {
            return new p1(1, null, 2, null);
        }
        ActionEdit.q5(activity, str, (String) null);
        return new p1(0, null, 2, null);
    }

    private static final r1 l7(Activity activity, Sensor sensor, SensorManager sensorManager, r8 r8Var, String str) {
        String c2;
        Float s;
        Float Z;
        f0 f0Var = new f0();
        f0Var.i = true;
        j0 j0Var = new j0();
        j0 j0Var2 = new j0();
        j0 j0Var3 = new j0();
        int i = 0;
        int i2 = 0;
        List list = null;
        j0Var3.i = new r(activity, sensor.getName() + " - First Situation", "", 0, i, i2, false, 0, null, 0, null, list, 4088, null);
        e eVar = new e(f0Var, j0Var, j0Var2, j0Var3);
        sensorManager.registerListener(eVar, sensor, 2, 200, r8Var.e());
        w7((r) j0Var3.i).f();
        f0Var.i = false;
        int i3 = 0;
        int i4 = 0;
        Integer num = null;
        r rVar = new r(activity, sensor.getName() + " - Second Situation", "", i, i2, 0 == true ? 1 : 0, 0 == true ? 1 : 0, i3, null, i4, num, null, 4088, list);
        j0Var3.i = rVar;
        w7(rVar).f();
        sensorManager.unregisterListener(eVar);
        r8Var.h();
        p1 p1Var = (p1) w7(new r(activity, 2131887010, "0", i, i2, (int) (0 == true ? 1 : 0), true, i3, "- First State: " + n7((float[]) j0Var.i) + "\n\n- Second State: " + n7((float[]) j0Var2.i) + "\n\nWhat margin of error do you want to give these values?", i4, num, 1720, (h) null)).f();
        if (p1Var == null || (c2 = p1Var.c()) == null || (s = q.s(c2)) == null) {
            return new r1();
        }
        float floatValue = s.floatValue();
        float[] fArr = (float[]) j0Var.i;
        if (fArr != null) {
            ArrayList arrayList = new ArrayList(fArr.length);
            int length = fArr.length;
            int i5 = 0;
            int i6 = 0;
            while (i5 < length) {
                float f2 = fArr[i5];
                int i10 = i6 + 1;
                float[] fArr2 = (float[]) j0Var2.i;
                arrayList.add((fArr2 == null || (Z = n.Z(fArr2, i6)) == null) ? null : b7.Q1(sensor, m7(str, i6), f2, Z.floatValue(), floatValue));
                i5++;
                i6 = i10;
            }
            List<r1> b0 = t.b0(arrayList);
            if (b0 != null) {
                r1 r1Var = new r1();
                int i11 = 0;
                for (r1 r1Var2 : b0) {
                    r1Var.addAll(r1Var2);
                    r1Var.m0(i11, i11 + 1, r1Var2.L(0, 1));
                    i11 += r1Var2.size();
                }
                return r1Var;
            }
        }
        return new r1();
    }

    public static final ti.r<we.l> m2(Activity activity) {
        p.i(activity, "activity");
        if (!d1.u(activity)) {
            ti.r<we.l> w = ti.r.w(new we.l(false));
            p.h(w, "just(...)");
            return w;
        }
        ti.r<p1> w72 = w7(new r(activity, 2131891307, 2131890602, 2131888049, 2131886746, 0, false, 0, (String) null, 0, (Integer) null, 2016, (h) null));
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                we.l n2;
                n2 = com.joaomgcd.taskerm.dialog.a.n2((p1) obj);
                return n2;
            }
        };
        ti.r<we.l> x = w72.x(new yi.e() {
            public final Object a(Object obj) {
                we.l o2;
                o2 = com.joaomgcd.taskerm.dialog.a.o2(lVar, obj);
                return o2;
            }
        });
        p.h(x, "map(...)");
        return x;
    }

    public static final v m3(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    public static final ti.r<p1> m4(Activity activity, int i, int i2) {
        p.i(activity, "activity");
        return p4(activity, i, i2, 0, 0, null, 56, null);
    }

    public static ti.r m5(Activity activity, boolean z, int i, Object obj) {
        if ((i & 2) != 0) {
            z = true;
        }
        return l5(activity, z);
    }

    public static final v m6(Throwable th) {
        p.i(th, "<unused var>");
        return ti.r.w(new p1(0, null, 2, null));
    }

    private static final String m7(String str, int i) {
        return "%" + str + (i + 1);
    }

    public static final we.l n2(p1 p1Var) {
        p.i(p1Var, "it");
        return !p1Var.k() ? new we.l(false) : new we.l(true);
    }

    public static final ti.r<pe> n3(final Activity activity, final se seVar) {
        p.i(activity, "activity");
        p.i(seVar, "error");
        if (com.joaomgcd.taskerm.util.r.a.s()) {
            ti.r<pe> w = ti.r.w(new ue());
            p.h(w, "just(...)");
            return w;
        }
        if (ac.a.z(ac.f, activity, 0, 2, (Object) null).i0()) {
            ti.r<pe> w2 = ti.r.w(new ue());
            p.h(w2, "just(...)");
            return w2;
        }
        ti.r<p1> w72 = w7(new r(activity, 2131887507, b7.j6(2131887152, activity, new Object[0]), 2131886894, 2131886892, 0, false, 0, (String) null, 0, (Integer) null, 2016, (h) null));
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                ti.v p3;
                p3 = com.joaomgcd.taskerm.dialog.a.p3(activity, seVar, (p1) obj);
                return p3;
            }
        };
        ti.r<pe> t = w72.t(new yi.e() {
            public final Object a(Object obj) {
                ti.v q3;
                q3 = com.joaomgcd.taskerm.dialog.a.q3(lVar, obj);
                return q3;
            }
        });
        p.h(t, "flatMap(...)");
        return t;
    }

    public static final ti.r<p1> n4(Activity activity, int i, int i2, int i3, int i4, String str) {
        p.i(activity, "activity");
        String j6 = b7.j6(i2, activity, new Object[0]);
        return o4(activity, i, j6, i3, i4, str == null ? j6 : str);
    }

    public static final o1 n5(Sensor sensor) {
        p.f(sensor);
        return new o1(b7.G3(sensor), null, false, 6, null);
    }

    public static final v n6(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    private static final String n7(float[] fArr) {
        return "\n" + (fArr != null ? n.k0(fArr, "\n", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, new l() {
            public final Object invoke(Object obj) {
                CharSequence o72;
                o72 = com.joaomgcd.taskerm.dialog.a.o7(((Float) obj).floatValue());
                return o72;
            }
        }, 30, (Object) null) : null);
    }

    public static final we.l o2(l lVar, Object obj) {
        p.i(obj, "p0");
        return (we.l) lVar.invoke(obj);
    }

    public static ti.r o3(Activity activity, se seVar, int i, Object obj) {
        if ((i & 2) != 0) {
            seVar = ac.f.T(activity);
        }
        return n3(activity, seVar);
    }

    public static final ti.r<p1> o4(final Activity activity, final int i, final String str, final int i2, final int i3, String str2) {
        p.i(activity, "activity");
        p.i(str, "text");
        p.i(str2, "tipKey");
        return rg.i.i(activity, new g0(str2), new ik.a() {
            public final Object e() {
                ti.r r4;
                r4 = com.joaomgcd.taskerm.dialog.a.r4();
                return r4;
            }
        }, new l() {
            public final Object invoke(Object obj) {
                boolean s4;
                s4 = com.joaomgcd.taskerm.dialog.a.s4((p1) obj);
                return Boolean.valueOf(s4);
            }
        }, (SharedPreferences) null, new ik.a() {
            public final Object e() {
                ti.r t4;
                t4 = com.joaomgcd.taskerm.dialog.a.t4(activity, i, str, i3, i2);
                return t4;
            }
        }, 8, (Object) null);
    }

    public static final e0 o5(Activity activity, Sensor sensor) {
        p.f(sensor);
        e2.C2(S3(activity, 2131887010, b7.v2(sensor, activity)), activity, new l() {
            public final Object invoke(Object obj) {
                vj.e0 p5;
                p5 = com.joaomgcd.taskerm.dialog.a.p5((p1) obj);
                return p5;
            }
        });
        return e0.a;
    }

    public static final v o6(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    public static final CharSequence o7(float f2) {
        return b7.a4(f2, 5);
    }

    public static final ti.r<p1> p2(final Activity activity) {
        p.i(activity, "activity");
        return c8(new l() {
            public final Object invoke(Object obj) {
                vj.e0 q2;
                q2 = com.joaomgcd.taskerm.dialog.a.q2(activity, (x7) obj);
                return q2;
            }
        }, null, 2, null);
    }

    public static final v p3(Activity activity, se seVar, p1 p1Var) {
        p.i(p1Var, "it");
        if (p1Var.o()) {
            return new GenericActionActivityRequestCallScreeningAccess().run(activity);
        }
        ti.r w = ti.r.w(seVar);
        p.f(w);
        return w;
    }

    public static ti.r p4(Activity activity, int i, int i2, int i3, int i4, String str, int i5, Object obj) {
        if ((i5 & 8) != 0) {
            i3 = -1;
        }
        int i6 = i3;
        if ((i5 & 16) != 0) {
            i4 = 2131886894;
        }
        int i10 = i4;
        if ((i5 & 32) != 0) {
            str = null;
        }
        return n4(activity, i, i2, i6, i10, str);
    }

    public static final e0 p5(p1 p1Var) {
        p.i(p1Var, "it");
        return e0.a;
    }

    public static final ti.r<we<String, j3>> p6(Context context, Intent intent, List<String> list, boolean z, List<String> list2) {
        p.i(context, "context");
        ti.r run = new GenericActionActivitySelectApp(intent, list, z, list2).run(context);
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                we r62;
                r62 = com.joaomgcd.taskerm.dialog.a.r6((pe) obj);
                return r62;
            }
        };
        ti.r<we<String, j3>> x = run.x(new yi.e() {
            public final Object a(Object obj) {
                we s62;
                s62 = com.joaomgcd.taskerm.dialog.a.s6(lVar, obj);
                return s62;
            }
        });
        p.h(x, "map(...)");
        return x;
    }

    public static final wi.b p7(Activity activity, int i) {
        p.i(activity, "activity");
        return e2.C2(p4(activity, 2131891107, i, 0, 0, null, 56, null), activity, new l() {
            public final Object invoke(Object obj) {
                vj.e0 q72;
                q72 = com.joaomgcd.taskerm.dialog.a.q7((p1) obj);
                return q72;
            }
        });
    }

    public static final e0 q2(Activity activity, x7 x7Var) {
        p.i(x7Var, "it");
        ep.t0(activity, x7Var).E(activity);
        return e0.a;
    }

    public static final v q3(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    public static ti.r q4(Activity activity, int i, String str, int i2, int i3, String str2, int i4, Object obj) {
        if ((i4 & 8) != 0) {
            i2 = -1;
        }
        int i5 = i2;
        if ((i4 & 16) != 0) {
            i3 = 2131886894;
        }
        return o4(activity, i, str, i5, i3, (i4 & 32) != 0 ? str : str2);
    }

    public static final v q5(final Activity activity, final t7 t7Var) {
        p.i(t7Var, "it");
        return e2.y1(new ik.a() {
            public final Object e() {
                j8 r5;
                r5 = com.joaomgcd.taskerm.dialog.a.r5(t7.this, activity);
                return r5;
            }
        });
    }

    public static ti.r q6(Context context, Intent intent, List list, boolean z, List list2, int i, Object obj) {
        if ((i & 2) != 0) {
            intent = null;
        }
        if ((i & 4) != 0) {
            list = null;
        }
        if ((i & 8) != 0) {
            z = false;
        }
        if ((i & 16) != 0) {
            list2 = null;
        }
        return p6(context, intent, list, z, list2);
    }

    public static final e0 q7(p1 p1Var) {
        p.i(p1Var, "it");
        return e0.a;
    }

    public static final ti.r<String> r2(Activity activity, com.joaomgcd.taskerm.util.f0 f0Var) {
        p.i(activity, "activity");
        p.i(f0Var, "title");
        String a2 = f0Var.a(activity);
        Integer[] numArr = {2131891290, 2131891194};
        ArrayList arrayList = new ArrayList(2);
        for (int i = 0; i < 2; i++) {
            arrayList.add(b7.j6(numArr[i].intValue(), activity, new Object[0]));
        }
        ti.r c0 = x0.c0(new s7(activity, a2, arrayList, false, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 262136, null));
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                String s2;
                s2 = com.joaomgcd.taskerm.dialog.a.s2((t7) obj);
                return s2;
            }
        };
        ti.r<String> x = c0.x(new yi.e() {
            public final Object a(Object obj) {
                String t2;
                t2 = com.joaomgcd.taskerm.dialog.a.t2(lVar, obj);
                return t2;
            }
        });
        p.h(x, "map(...)");
        return x;
    }

    public static final ti.r<pe> r3(final Activity activity) {
        p.i(activity, "activity");
        ti.r<p1> w72 = w7(new r(activity, 2131887507, 2131890246, 2131888756, 2131887524, 0, false, 0, (String) null, 0, (Integer) null, 2016, (h) null));
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                ti.v s3;
                s3 = com.joaomgcd.taskerm.dialog.a.s3(activity, (p1) obj);
                return s3;
            }
        };
        ti.r<pe> t = w72.t(new yi.e() {
            public final Object a(Object obj) {
                ti.v t3;
                t3 = com.joaomgcd.taskerm.dialog.a.t3(lVar, obj);
                return t3;
            }
        });
        p.h(t, "flatMap(...)");
        return t;
    }

    public static final ti.r r4() {
        ti.r w = ti.r.w(new p1(1, null, 2, null));
        p.h(w, "just(...)");
        return w;
    }

    public static final j8 r5(t7 t7Var, Activity activity) {
        Sensor sensor = (Sensor) t7Var.c();
        if (sensor == null) {
            throw new RuntimeException(b7.j6(2131891156, activity, new Object[0]));
        }
        p1 p1Var = (p1) w7(new r(activity, 2131887508, 2131887261, 2131889804, 2131890050, 0, false, 0, (String) null, 0, (Integer) null, 2016, (h) null)).f();
        if (p1Var.j()) {
            throw new RuntimeException(b7.j6(2131891156, activity, new Object[0]));
        }
        return new j8(sensor, p1Var.o() ? b7.G3(sensor) : String.valueOf(sensor.getType()));
    }

    public static final we r6(pe peVar) {
        p.i(peVar, "it");
        return peVar instanceof we ? (we) peVar : peVar instanceof se ? new we(false, (Object) null, new j3(((se) peVar).g())) : new we(false, (Object) null, new j3("Unknown error"));
    }

    public static final ti.r<String> r7(final Activity activity) {
        p.i(activity, "activity");
        ti.r<Integer> u72 = u7(activity);
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                String s72;
                s72 = com.joaomgcd.taskerm.dialog.a.s7(activity, (Integer) obj);
                return s72;
            }
        };
        ti.r<String> x = u72.x(new yi.e() {
            public final Object a(Object obj) {
                String t72;
                t72 = com.joaomgcd.taskerm.dialog.a.t7(lVar, obj);
                return t72;
            }
        });
        p.h(x, "map(...)");
        return x;
    }

    public static final String s2(t7 t7Var) {
        p.i(t7Var, "it");
        String str = (String) t7Var.c();
        if (str == null) {
            throw new RuntimeException("Nothing selected");
        }
        String lowerCase = str.toLowerCase(Locale.ROOT);
        p.h(lowerCase, "toLowerCase(...)");
        return String.valueOf(Boolean.parseBoolean(lowerCase));
    }

    public static final v s3(Activity activity, p1 p1Var) {
        p.i(p1Var, "dialogMessage");
        if (!p1Var.k()) {
            return p1Var.o() ? new GenericActionActivityRequestDigitalAssistantPermission().run(activity) : ti.r.w(te.c("missing digital assistant permission"));
        }
        ActionEdit.q5(activity, "secure_setting_grant", (String) null);
        return ti.r.w(new ue());
    }

    public static final boolean s4(p1 p1Var) {
        p.i(p1Var, "it");
        return p1Var.n();
    }

    public static final v s5(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    public static final we s6(l lVar, Object obj) {
        p.i(obj, "p0");
        return (we) lVar.invoke(obj);
    }

    public static final String s7(Activity activity, Integer num) {
        p.i(num, "it");
        return (String) n.C0(vf.a.a.k(activity)).get(num.intValue());
    }

    public static final String t2(l lVar, Object obj) {
        p.i(obj, "p0");
        return (String) lVar.invoke(obj);
    }

    public static final v t3(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    public static final ti.r t4(Activity activity, int i, String str, int i2, int i3) {
        return w7(new r(activity, i, str, i2, i3, 2131886905, false, 0, (String) null, 0, (Integer) null, 1984, (h) null));
    }

    public static final ti.r<String> t5(Context context) {
        p.i(context, "context");
        ti.r run = new GenericActionActivityPickShortcut().run(context);
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                ti.v u5;
                u5 = com.joaomgcd.taskerm.dialog.a.u5((pe) obj);
                return u5;
            }
        };
        ti.r<String> t = run.t(new yi.e() {
            public final Object a(Object obj) {
                ti.v v5;
                v5 = com.joaomgcd.taskerm.dialog.a.v5(lVar, obj);
                return v5;
            }
        });
        p.h(t, "flatMap(...)");
        return t;
    }

    public static final ti.r<String> t6(final Activity activity) {
        p.i(activity, "activity");
        return e2.y1(new ik.a() {
            public final Object e() {
                String u62;
                u62 = com.joaomgcd.taskerm.dialog.a.u6(activity);
                return u62;
            }
        });
    }

    public static final String t7(l lVar, Object obj) {
        p.i(obj, "p0");
        return (String) lVar.invoke(obj);
    }

    private static final ti.r<String> u2(final Activity activity, final c5.l lVar, final boolean z) {
        ti.r c82 = c8(new l() {
            public final Object invoke(Object obj) {
                vj.e0 v2;
                v2 = com.joaomgcd.taskerm.dialog.a.v2(activity, lVar, z, (x7) obj);
                return v2;
            }
        }, null, 2, null);
        final l lVar2 = new l() {
            public final Object invoke(Object obj) {
                String w2;
                w2 = com.joaomgcd.taskerm.dialog.a.w2(activity, (p1) obj);
                return w2;
            }
        };
        ti.r<String> x = c82.x(new yi.e() {
            public final Object a(Object obj) {
                String x2;
                x2 = com.joaomgcd.taskerm.dialog.a.x2(lVar2, obj);
                return x2;
            }
        });
        p.h(x, "map(...)");
        return x;
    }

    public static final ti.r<pe> u3(final Activity activity, final se seVar) {
        p.i(activity, "activity");
        p.i(seVar, "error");
        if (ac.a.G(ac.f, activity, 0, 2, (Object) null).i0()) {
            ti.r<pe> w = ti.r.w(new ue());
            p.h(w, "just(...)");
            return w;
        }
        ti.r<p1> w72 = w7(new r(activity, 2131887507, b7.j6(2131887268, activity, new Object[0]), 2131886894, 2131886892, 0, false, 0, (String) null, 0, (Integer) null, 2016, (h) null));
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                ti.v w3;
                w3 = com.joaomgcd.taskerm.dialog.a.w3(activity, seVar, (p1) obj);
                return w3;
            }
        };
        ti.r<pe> t = w72.t(new yi.e() {
            public final Object a(Object obj) {
                ti.v z3;
                z3 = com.joaomgcd.taskerm.dialog.a.z3(lVar, obj);
                return z3;
            }
        });
        p.h(t, "flatMap(...)");
        return t;
    }

    public static final wi.b u4(final Activity activity, int i, com.joaomgcd.taskerm.util.e0 e0Var, final ik.a<e0> aVar) {
        p.i(activity, "activity");
        p.i(e0Var, "text");
        return e2.C2(W3(activity, i, e0Var.b(), 2131888381, null, 16, null), activity, new l() {
            public final Object invoke(Object obj) {
                vj.e0 w4;
                w4 = com.joaomgcd.taskerm.dialog.a.w4(aVar, activity, (p1) obj);
                return w4;
            }
        });
    }

    public static final v u5(pe peVar) {
        p.i(peVar, "it");
        if (!peVar.b()) {
            return ti.r.r(new RuntimeException("Couldn't get shortcut"));
        }
        Intent intent = (Intent) ((we) peVar).d();
        return intent == null ? ti.r.r(new RuntimeException("No shortcut data")) : ti.r.w(intent.toUri(0));
    }

    public static final String u6(final Activity activity) {
        String str;
        df.s sVar = (df.s) ((t7) x0.c0(new s7(activity, 2131887552, (List) t.f(new df.s[]{new df.s(activity, 2131887365, new ik.a() {
            public final Object e() {
                String v62;
                v62 = com.joaomgcd.taskerm.dialog.a.v6(activity);
                return v62;
            }
        }), new df.s(activity, 2131887358, new ik.a() {
            public final Object e() {
                String w62;
                w62 = com.joaomgcd.taskerm.dialog.a.w6(activity);
                return w62;
            }
        })}), false, (l) null, (Integer) null, (l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 65520, (h) null)).f()).c();
        return (sVar == null || (str = (String) sVar.a().e()) == null) ? "" : str;
    }

    public static final ti.r<Integer> u7(final Activity activity) {
        p.i(activity, "activity");
        return e2.y1(new ik.a() {
            public final Object e() {
                int v72;
                v72 = com.joaomgcd.taskerm.dialog.a.v7(activity);
                return Integer.valueOf(v72);
            }
        });
    }

    public static final e0 v2(Activity activity, c5.l lVar, boolean z, x7 x7Var) {
        p.i(x7Var, "it");
        c5.D(activity, x7Var, lVar, z, false).C(activity);
        return e0.a;
    }

    public static ti.r v3(Activity activity, se seVar, int i, Object obj) {
        if ((i & 2) != 0) {
            seVar = ac.f.T(activity);
        }
        return u3(activity, seVar);
    }

    public static wi.b v4(Activity activity, int i, com.joaomgcd.taskerm.util.e0 e0Var, ik.a aVar, int i2, Object obj) {
        if ((i2 & 8) != 0) {
            aVar = null;
        }
        return u4(activity, i, e0Var, aVar);
    }

    public static final v v5(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    public static final String v6(Activity activity) {
        return ((p1) c4(activity, 2131887231, "1", 0, true, null, 40, null).f()).c();
    }

    public static final int v7(Activity activity) {
        if (!((pe) new ac(activity, 0, t.d("android.permission.READ_PHONE_STATE"), 2, (h) null).X(activity).f()).b()) {
            throw new RuntimeException("Need permission");
        }
        Integer b2 = ((t7) x0.c0(new s7(activity, 2131889966, n.C0(vf.a.a.k(activity)), false, (l) null, (Integer) null, (l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 65528, (h) null)).f()).b();
        if (b2 != null) {
            return b2.intValue();
        }
        throw new RuntimeException("No SIM card selected");
    }

    public static final String w2(Activity activity, p1 p1Var) {
        Integer g;
        String uri;
        p.i(p1Var, "it");
        Bundle b2 = p1Var.b();
        if (b2 == null || (g = p1Var.g()) == null || g.intValue() != 1) {
            throw new RuntimeException("Not selected");
        }
        String string = b2.getString("name");
        int i = b2.getInt("tint", 0);
        g gVar = new g(string);
        if (i != 0) {
            gVar.x0(i);
        }
        Uri A0 = gVar.A0(activity);
        if (A0 == null || (uri = A0.toString()) == null) {
            throw new RuntimeException("Invalid icon");
        }
        return uri;
    }

    public static final v w3(Activity activity, final se seVar, p1 p1Var) {
        p.i(p1Var, "it");
        if (!p1Var.o()) {
            ti.r w = ti.r.w(seVar);
            p.f(w);
            return w;
        }
        ti.r run = new GenericActionActivityRequestDoNotDisturbAccess().run(activity);
        final l lVar = new l() {
            public final Object invoke(Object obj) {
                ti.v x3;
                x3 = com.joaomgcd.taskerm.dialog.a.x3(seVar, (Throwable) obj);
                return x3;
            }
        };
        ti.r C = run.C(new yi.e() {
            public final Object a(Object obj) {
                ti.v y3;
                y3 = com.joaomgcd.taskerm.dialog.a.y3(lVar, obj);
                return y3;
            }
        });
        p.f(C);
        return C;
    }

    public static final e0 w4(ik.a aVar, Activity activity, p1 p1Var) {
        p.i(p1Var, "it");
        if (p1Var.o() && aVar != null) {
            aVar.e();
        }
        if (!p1Var.k()) {
            return e0.a;
        }
        if (aVar != null) {
            aVar.e();
        }
        ExtensionsContextKt.e0(activity, "https://tasker.joaoapps.com/userguide/en/variables.html#json", false, false, false, 14, (Object) null);
        return e0.a;
    }

    public static final ti.r<String> w5(final Activity activity, final String str) {
        p.i(activity, "context");
        p.i(str, "title");
        return e2.y1(new ik.a() {
            public final Object e() {
                String x5;
                x5 = com.joaomgcd.taskerm.dialog.a.x5(activity, str);
                return x5;
            }
        });
    }

    public static final String w6(Activity activity) {
        String c2 = ((p1) c4(activity, 2131887231, "0", 0, true, null, 40, null).f()).c();
        if (c2 == null || c2.length() == 0) {
            return "";
        }
        String c3 = ((p1) c4(activity, 2131887340, "", 0, true, null, 40, null).f()).c();
        return jg.l.m.a(c2, c3 != null ? c3 : "");
    }

    public static final ti.r<p1> w7(final r rVar) {
        p.i(rVar, "args");
        return c8(new l() {
            public final Object invoke(Object obj) {
                vj.e0 x72;
                x72 = com.joaomgcd.taskerm.dialog.a.x7(r.this, (x7) obj);
                return x72;
            }
        }, null, 2, null);
    }

    public static final String x2(l lVar, Object obj) {
        p.i(obj, "p0");
        return (String) lVar.invoke(obj);
    }

    public static final v x3(se seVar, Throwable th) {
        p.i(th, "it");
        return ti.r.w(seVar);
    }

    public static final ti.r<p1> x4(Activity activity, String str, String str2, int i) {
        p.i(activity, "activity");
        p.i(str, "title");
        return w7(new r(activity, str, str2, 2131886879, 2131886878, i, false, 0, null, 0, null, null, 4032, null));
    }

    public static final String x5(Activity activity, String str) {
        ActivityInfo activityInfo;
        ActivityInfo activityInfo2;
        final PackageManager packageManager = activity.getPackageManager();
        List<ResolveInfo> queryIntentActivities = packageManager.queryIntentActivities(new Intent("android.speech.tts.engine.CHECK_TTS_DATA"), 0);
        p.h(queryIntentActivities, "queryIntentActivities(...)");
        ArrayList arrayList = new ArrayList();
        for (Object obj : queryIntentActivities) {
            ResolveInfo resolveInfo = (ResolveInfo) obj;
            if (((resolveInfo == null || (activityInfo2 = resolveInfo.activityInfo) == null) ? null : activityInfo2.applicationInfo) != null) {
                arrayList.add(obj);
            }
        }
        ResolveInfo resolveInfo2 = arrayList.size() == 1 ? (ResolveInfo) arrayList.get(0) : (ResolveInfo) ((t7) x0.c0(new s7(activity, str, arrayList, true, new l() {
            public final Object invoke(Object obj2) {
                o1 y5;
                y5 = com.joaomgcd.taskerm.dialog.a.y5(packageManager, (ResolveInfo) obj2);
                return y5;
            }
        }, null, null, null, null, null, null, null, null, null, null, null, null, null, 262112, null)).f()).c();
        if (resolveInfo2 == null || (activityInfo = resolveInfo2.activityInfo) == null) {
            throw new RuntimeException("Could not get TTS engine");
        }
        String str2 = activityInfo.packageName;
        Intent intent = new Intent();
        intent.setComponent(new ComponentName(str2, activityInfo.name));
        intent.setAction("android.speech.tts.engine.CHECK_TTS_DATA");
        ArrayList<String> stringArrayListExtra = ((Intent) b7.M5(intent, activity, (Integer) null, (Integer) null, (Long) null, 14, (Object) null).f()).getStringArrayListExtra("availableVoices");
        if (stringArrayListExtra == null) {
            throw new RuntimeException("Could not available TTS voices or no voices available");
        }
        String str3 = (String) ((t7) x0.c0(new s7(activity, str, t.O0(stringArrayListExtra), true, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 262128, null)).f()).c();
        if (str3 == null) {
            throw new RuntimeException("Could not get TTS engine");
        }
        return str2 + ":" + str3;
    }

    public static final ti.r<String> x6(final Context context, final boolean z, final String str, final boolean z2, final boolean z3, final Long l) {
        p.i(context, "context");
        return e2.y1(new ik.a() {
            public final Object e() {
                String z62;
                z62 = com.joaomgcd.taskerm.dialog.a.z6(context, z2, str, l, z, z3);
                return z62;
            }
        });
    }

    public static final e0 x7(r rVar, x7 x7Var) {
        p.i(x7Var, "it");
        com.joaomgcd.taskerm.util.e0 o = rVar.o();
        String b2 = o != null ? o.b() : null;
        com.joaomgcd.taskerm.util.e0 m = rVar.m();
        String b3 = m != null ? m.b() : null;
        com.joaomgcd.taskerm.util.e0 k = rVar.k();
        String b4 = k != null ? k.b() : null;
        com.joaomgcd.taskerm.util.e0 i = rVar.i();
        String b5 = i != null ? i.b() : null;
        com.joaomgcd.taskerm.util.e0 j = rVar.j();
        TextBoxDialogFragment I = TextBoxDialogFragment.I(x7Var, b2, b3, b4, b5, j != null ? j.b() : null, rVar.g(), rVar.l(), rVar.f(), rVar.n(), rVar.h());
        I.E(rVar.a());
        rVar.p(I);
        return e0.a;
    }

    public static final ti.r<String> y2(Activity activity, boolean z) {
        p.i(activity, "activity");
        return u2(activity, c5.l.i, z);
    }

    public static final v y3(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    public static ti.r y4(Activity activity, String str, String str2, int i, int i2, Object obj) {
        if ((i2 & 8) != 0) {
            i = -1;
        }
        return x4(activity, str, str2, i);
    }

    public static final o1 y5(PackageManager packageManager, ResolveInfo resolveInfo) {
        p.i(resolveInfo, "it");
        return new o1(packageManager.getApplicationLabel(resolveInfo.activityInfo.applicationInfo).toString(), null, false, 6, null);
    }

    public static ti.r y6(Context context, boolean z, String str, boolean z2, boolean z3, Long l, int i, Object obj) {
        if ((i & 2) != 0) {
            z = true;
        }
        if ((i & 4) != 0) {
            str = null;
        }
        if ((i & 8) != 0) {
            z2 = false;
        }
        if ((i & 16) != 0) {
            z3 = true;
        }
        if ((i & 32) != 0) {
            l = null;
        }
        return x6(context, z, str, z2, z3, l);
    }

    public static final ti.r<p1> y7(Activity activity, int i) {
        p.i(activity, "activity");
        return R3(activity, 2131890883, i);
    }

    public static ti.r z2(Activity activity, boolean z, int i, Object obj) {
        if ((i & 2) != 0) {
            z = false;
        }
        return y2(activity, z);
    }

    public static final v z3(l lVar, Object obj) {
        p.i(obj, "p0");
        return (v) lVar.invoke(obj);
    }

    @SuppressLint({"MissingPermission"})
    public static final ti.r<t7<BluetoothDevice>> z4(Activity activity) {
        p.i(activity, "activity");
        if (!ac.f.W0(activity)) {
            ti.r<t7<BluetoothDevice>> r = ti.r.r(new RuntimeException("Need Nearby devices permission"));
            p.h(r, "error(...)");
            return r;
        }
        if (BluetoothAdapter.getDefaultAdapter().isEnabled()) {
            return x0.c0(new s7(activity, 2131886256, bi.y(), true, new l() {
                public final Object invoke(Object obj) {
                    o1 A4;
                    A4 = com.joaomgcd.taskerm.dialog.a.A4((BluetoothDevice) obj);
                    return A4;
                }
            }, (Integer) null, (l) null, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 65504, (h) null));
        }
        ti.r<t7<BluetoothDevice>> r2 = ti.r.r(new RuntimeException("Bluetooth is disabled on your device"));
        p.h(r2, "error(...)");
        return r2;
    }

    public static final ti.r<g8> z5(final Activity activity, final g8 g8Var, final String str, final String str2) {
        p.i(activity, "activity");
        final Calendar calendar = Calendar.getInstance();
        final sj.d V = sj.d.V();
        p.h(V, "create(...)");
        final ik.q qVar = new ik.q() {
            public final Object g(Object obj, Object obj2, Object obj3) {
                vj.e0 B5;
                B5 = com.joaomgcd.taskerm.dialog.a.B5(V, (TimePicker) obj, ((Integer) obj2).intValue(), ((Integer) obj3).intValue());
                return B5;
            }
        };
        e2.a1(new ik.a() {
            public final Object e() {
                vj.e0 C5;
                C5 = com.joaomgcd.taskerm.dialog.a.C5(activity, qVar, g8Var, calendar, str, str2, V);
                return C5;
            }
        });
        return V;
    }

    public static final String z6(Context context, boolean z, String str, Long l, boolean z2, boolean z3) {
        Intent intent;
        ti.r Q5;
        if ((context instanceof Activity) && ((Boolean) ac.a.x1(ac.f, (Activity) context, 0, 2, (Object) null).f()).booleanValue()) {
            throw new RuntimeException("No file read permissions");
        }
        if (z) {
            intent = FileSelect.u0(context, (String) null, str, FileSelect.e.q, (String) null, true, true);
        } else {
            Intent w = d4.w(true);
            w.putExtra("android.provider.extra.INITIAL_URI", l7.D(str));
            w.putExtra("android.intent.extra.LOCAL_ONLY", true);
            intent = w;
        }
        if (z) {
            p.f(intent);
            Q5 = b7.M5(intent, context, (Integer) null, (Integer) null, l, 6, (Object) null);
        } else {
            p.f(intent);
            Q5 = b7.Q5(intent, context, (Integer) null, (Integer) null, l, 6, (Object) null);
        }
        return (String) n.Q(ph.R((Intent) Q5.f(), context, z, z2, z3).toArray(new String[0]));
    }

    public static final ti.r<p1> z7(Activity activity, int i) {
        p.i(activity, "activity");
        return p4(activity, 2131890883, i, 0, 0, null, 56, null);
    }

    public static final void h2(p1 p1Var) {
    }
}