导航菜单

页面标题

页面副标题

Tasker v6.6.3 - r.java 源代码

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

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


package com.joaomgcd.taskerm.helper;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.Editable;
import android.view.KeyEvent;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import com.joaomgcd.oldtaskercompat.aigenerator.ui.ActivityAIChat;
import com.joaomgcd.tasker2024.edittask.ActivityEditTask2024;
import com.joaomgcd.taskerm.helper.r;
import com.joaomgcd.taskerm.settings.d1;
import com.joaomgcd.taskerm.share.ActivityReceiveShare;
import com.joaomgcd.taskerm.structuredoutput.StructureType;
import com.joaomgcd.taskerm.util.ExtensionsContextKt;
import com.joaomgcd.taskerm.util.b7;
import com.joaomgcd.taskerm.util.g0;
import com.joaomgcd.taskerm.util.h5;
import com.joaomgcd.taskerm.util.l7;
import com.joaomgcd.taskerm.util.o8;
import com.joaomgcd.taskerm.util.of;
import com.joaomgcd.taskerm.util.pe;
import com.joaomgcd.taskerm.util.s8;
import com.joaomgcd.taskerm.util.xe;
import df.h8;
import df.l1;
import df.o1;
import df.p1;
import df.s7;
import df.t7;
import df.x0;
import gg.w;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import kotlin.Pair;
import net.dinglisch.android.taskerm.MacroEdit;
import net.dinglisch.android.taskerm.Main;
import net.dinglisch.android.taskerm.Settings;
import net.dinglisch.android.taskerm.b2;
import net.dinglisch.android.taskerm.fn;
import net.dinglisch.android.taskerm.fo;
import net.dinglisch.android.taskerm.io;
import net.dinglisch.android.taskerm.mj;
import net.dinglisch.android.taskerm.ni;
import net.dinglisch.android.taskerm.o7;
import net.dinglisch.android.taskerm.pi;
import sg.a4;
import vj.e0;
import xg.e2;

public final class r extends com.joaomgcd.taskerm.helper.h<Main> {
    private final o8<sj.a> l;
    private final sj.b<e0> m;

    public static final class a {
        private final boolean a;
        private final boolean b;

        public a(boolean z, boolean z2) {
            this.a = z;
            this.b = z2;
        }

        public final boolean a() {
            return this.b;
        }

        public a(boolean z) {
            this(z, true);
        }
    }

    public interface b {
    }

    public static final class c extends d {
        private final View b;
        private final int c;
        private final boolean d;

        public c(View view, int i, int i2, boolean z) {
            super(i);
            jk.p.i(view, "taskView");
            this.b = view;
            this.c = i2;
            this.d = z;
        }

        public final boolean b() {
            return this.d;
        }

        public final View c() {
            return this.b;
        }

        public final int d() {
            return this.c;
        }
    }

    public static class d implements b {
        private final int a;

        public d(int i) {
            this.a = i;
        }

        public final int a() {
            return this.a;
        }
    }

    public static final class e extends d {
        private final int b;

        public e(int i, int i2) {
            super(i);
            this.b = i2;
        }

        public final int b() {
            return this.b;
        }
    }

    private static final class f {
        public static final f i = new f("Preferences", 0);
        public static final f q = new f("ToggleTasker", 1);
        public static final f r = new f("SaveSetup", 2);
        public static final f s = new f("LicenseValidation", 3);
        private static final f[] t;
        private static final ck.a u;

        static {
            f[] a = a();
            t = a;
            u = ck.b.a(a);
        }

        private f(String str, int i2) {
        }

        private static final f[] a() {
            return new f[]{i, q, r, s};
        }

        public static f valueOf(String str) {
            return (f) Enum.valueOf(f.class, str);
        }

        public static f[] values() {
            return (f[]) t.clone();
        }
    }

    static final class g {
        private final fn a;
        private final fn b;
        private final List<net.dinglisch.android.taskerm.c> c;

        public g(fn fnVar, fn fnVar2, List<? extends net.dinglisch.android.taskerm.c> list) {
            jk.p.i(fnVar, "originalTask");
            jk.p.i(fnVar2, "taskThatReferencesOriginal");
            jk.p.i(list, "performTaskActionsInTaskThatReferenceOriginal");
            this.a = fnVar;
            this.b = fnVar2;
            this.c = list;
        }

        public final fn a() {
            return this.a;
        }

        public final fn b() {
            return this.b;
        }
    }

    public static final class h {
        public static final int[] a;

        static {
            int[] iArr = new int[f.values().length];
            try {
                iArr[f.i.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                iArr[f.q.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                iArr[f.r.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                iArr[f.s.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            a = iArr;
        }
    }

    public static final class i implements ik.l<f, String> {
        public static final i i = new i();

        @Override
        public final String invoke(f fVar) {
            jk.p.i(fVar, "it");
            return l7.a0(fVar.name());
        }
    }

    public static final class j implements ik.l<f, Boolean> {
        public static final j i = new j();

        @Override
        public final Boolean invoke(f fVar) {
            jk.p.i(fVar, "it");
            return Boolean.TRUE;
        }
    }

    public static final class k extends Handler {
        final pi a;
        final r b;

        k(pi piVar, r rVar) {
            this.a = piVar;
            this.b = rVar;
        }

        @Override
        public void handleMessage(Message message) {
            jk.p.i(message, "m");
            if (message.what != 0) {
                return;
            }
            Bundle data = message.getData();
            jk.p.h(data, "getData(...)");
            String string = data.getString("v");
            if (string != null) {
                this.a.r0((a4) eg.f.c().h(string, a4.class));
            }
            this.a.j0(data.getString("c"));
            this.b.q1().Ta();
        }
    }

    public r(Main main) {
        super(main);
        jk.p.i(main, "activity");
        this.l = s8.c(new ik.a() {
            @Override
            public final Object e() {
                sj.a y4;
                y4 = com.joaomgcd.taskerm.helper.r.y4();
                return y4;
            }
        });
        sj.b<e0> A0 = sj.b.A0();
        jk.p.h(A0, "create(...)");
        this.m = A0;
    }

    private final void A4(String str) {
        o7.f("T", str);
    }

    public static final Integer C3(boolean z, int i2, int i3, p1 p1Var) {
        Integer t;
        jk.p.i(p1Var, "it");
        String c2 = p1Var.c();
        int intValue = (c2 == null || (t = sk.q.t(c2)) == null) ? 1 : t.intValue();
        return Integer.valueOf(Math.min(Math.max(1, z ? i2 - intValue : i2 + intValue), i3 - 1));
    }

    public static final List C4(List list) {
        ArrayList arrayList = new ArrayList(kotlin.collections.t.w(list, 10));
        for (Object obj : list) {
            jk.p.g(obj, "null cannot be cast to non-null type net.dinglisch.android.taskerm.TaskerProfile");
            arrayList.add(Integer.valueOf(((io) obj).C0()));
        }
        return arrayList;
    }

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

    public static final e0 D4(r rVar, int i2, int i3) {
        rVar.f4().W3(i2, i3);
        return e0.a;
    }

    public static final e0 F3(r rVar, String str, StructureType structureType) {
        com.joaomgcd.taskerm.structuredoutput.b.a.c(rVar.q1(), str, structureType);
        return e0.a;
    }

    public static final List F4(List list) {
        ArrayList arrayList = new ArrayList(kotlin.collections.t.w(list, 10));
        for (Object obj : list) {
            jk.p.g(obj, "null cannot be cast to non-null type net.dinglisch.android.taskerm.Scene");
            arrayList.add(((mj) obj).getName());
        }
        return arrayList;
    }

    public static final e0 G4(r rVar, String str, int i2) {
        rVar.f4().Z3(str, i2);
        return e0.a;
    }

    public static final e0 H3(r rVar, Pair pair) {
        jk.p.i(pair, "it");
        rVar.q1().q7(((Number) pair.getFirst()).intValue());
        rVar.q1().Z4(rVar.q1().D5());
        return e0.a;
    }

    public static final List I4(List list) {
        ArrayList arrayList = new ArrayList(kotlin.collections.t.w(list, 10));
        for (Object obj : list) {
            jk.p.g(obj, "null cannot be cast to non-null type net.dinglisch.android.taskerm.Task");
            arrayList.add(Integer.valueOf(((fn) obj).P0()));
        }
        return arrayList;
    }

    public static final e0 J4(r rVar, int i2, int i3) {
        rVar.f4().b4(i2, i3);
        return e0.a;
    }

    public static final e0 K3(r rVar, g gVar) {
        jk.p.i(gVar, "it");
        rVar.q1().F6(gVar.b().P0());
        return e0.a;
    }

    private final <TId> void K4(final b2.a aVar, final ik.a<? extends List<? extends TId>> aVar2, final ik.p<? super TId, ? super Integer, e0> pVar) {
        q0(com.joaomgcd.taskerm.dialog.a.e5(q1(), f4(), 2131890330, (List) null, 8, (Object) null), new yi.d() {
            @Override
            public final void accept(Object obj) {
                com.joaomgcd.taskerm.helper.r.L4(ik.a.this, this, aVar, pVar, (Pair) obj);
            }
        });
    }

    public static final e0 L3(int[] iArr, boolean z, List list, ik.l lVar, final r rVar, ik.l lVar2) {
        g gVar;
        if (iArr.length != 1 || z) {
            Pair pair = (Pair) N3(rVar, lVar2, iArr, list, null, new ik.l() {
                @Override
                public final Object invoke(Object obj) {
                    df.o1 Q3;
                    Q3 = com.joaomgcd.taskerm.helper.r.Q3(com.joaomgcd.taskerm.helper.r.this, (Pair) obj);
                    return Q3;
                }
            }, 16, null);
            if (pair == null) {
                return e0.a;
            }
            List list2 = (List) pair.getSecond();
            if (list2.size() == 1) {
                gVar = (g) kotlin.collections.t.e0(list2);
            } else {
                gVar = (g) ((t7) x0.c0(new s7(rVar.q1(), 2131890333, list2, false, new ik.l() {
                    @Override
                    public final Object invoke(Object obj) {
                        o1 R3;
                        R3 = r.R3(r.this, (r.g) obj);
                        return R3;
                    }
                }, (Integer) null, lVar, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, (com.joaomgcd.taskerm.util.e0) null, b7.a6(2131886870, rVar.q1()), (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 61352, (jk.h) null)).f()).c();
            }
        } else {
            gVar = (g) M3(rVar, lVar2, iArr, (List) ((Pair) kotlin.collections.t.e0(list)).getSecond(), lVar, new ik.l() {
                @Override
                public final Object invoke(Object obj) {
                    o1 P3;
                    P3 = r.P3(r.this, (r.g) obj);
                    return P3;
                }
            });
        }
        if (gVar == null) {
            return e0.a;
        }
        final int P0 = gVar.b().P0();
        rVar.O(new Runnable() {
            @Override
            public final void run() {
                com.joaomgcd.taskerm.helper.r.S3(com.joaomgcd.taskerm.helper.r.this, P0);
            }
        });
        return e0.a;
    }

    public static final void L4(ik.a aVar, r rVar, b2.a aVar2, ik.p pVar, Pair pair) {
        jk.p.i(pair, "pair");
        List list = (List) aVar.e();
        int intValue = ((Number) pair.getFirst()).intValue();
        Iterator it = list.iterator();
        while (it.hasNext()) {
            pVar.n(it.next(), Integer.valueOf(intValue));
        }
        rVar.q1().K6(false, aVar2);
        rVar.q1().v();
    }

    private static final <T> T M3(r rVar, final ik.l<? super int[], e0> lVar, final int[] iArr, List<? extends T> list, ik.l<? super T, e0> lVar2, ik.l<? super T, o1> lVar3) {
        t7 t7Var = (t7) x0.c0(new s7(rVar.q1(), 2131890722, list, false, lVar3, (Integer) null, lVar2, (Boolean) null, (Boolean) null, (Integer) null, (Integer) null, b7.a6(2131886894, rVar.q1()), b7.a6(2131887378, rVar.q1()), (com.joaomgcd.taskerm.util.e0) null, (Boolean) null, (Boolean) null, 59304, (jk.h) null)).f();
        if (!t7Var.a().k()) {
            return (T) t7Var.c();
        }
        rVar.O(new Runnable() {
            @Override
            public final void run() {
                com.joaomgcd.taskerm.helper.r.O3(ik.l.this, iArr);
            }
        });
        return null;
    }

    public static final void M4(r rVar, e0 e0Var) {
        ni niVar = rVar.q1().x;
        if (niVar == null) {
            return;
        }
        o7.f("T", "Notifying profile adapter of change");
        niVar.notifyDataSetChanged();
    }

    static Object N3(r rVar, ik.l lVar, int[] iArr, List list, ik.l lVar2, ik.l lVar3, int i2, Object obj) {
        if ((i2 & 16) != 0) {
            lVar2 = null;
        }
        return M3(rVar, lVar, iArr, list, lVar2, lVar3);
    }

    public static final void O3(ik.l lVar, int[] iArr) {
        lVar.invoke(iArr);
    }

    public static final o1 P3(r rVar, g gVar) {
        jk.p.i(gVar, "it");
        return new o1(rVar.h4(gVar), (net.dinglisch.android.taskerm.g) null, false, 6, (jk.h) null);
    }

    public static final o1 Q3(r rVar, Pair pair) {
        jk.p.i(pair, "it");
        fn fnVar = (fn) pair.getFirst();
        Iterable iterable = (Iterable) pair.getSecond();
        ArrayList arrayList = new ArrayList(kotlin.collections.t.w(iterable, 10));
        Iterator it = iterable.iterator();
        while (it.hasNext()) {
            arrayList.add(rVar.h4((g) it.next()));
        }
        String string = rVar.R().getString(2131891315, fnVar.j(), kotlin.collections.t.n0(arrayList, ", ", null, null, 0, null, null, 62, null));
        jk.p.h(string, "getString(...)");
        return new o1(string, (net.dinglisch.android.taskerm.g) null, false, 6, (jk.h) null);
    }

    public static final e0 Q4(List list, final r rVar) {
        final io ioVar;
        if (list.size() == 1) {
            ioVar = (io) list.get(0);
        } else {
            t7 t7Var = (t7) x0.c0(new s7(rVar.q1(), 2131890604, list, false, new ik.l() {
                @Override
                public final Object invoke(Object obj) {
                    df.o1 R4;
                    R4 = com.joaomgcd.taskerm.helper.r.R4(com.joaomgcd.taskerm.helper.r.this, (io) obj);
                    return R4;
                }
            }, (Integer) null, (ik.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, (jk.h) null)).f();
            if (t7Var == null || (ioVar = (io) t7Var.c()) == null) {
                return e0.a;
            }
        }
        ioVar.x0();
        rVar.O(new Runnable() {
            @Override
            public final void run() {
                com.joaomgcd.taskerm.helper.r.S4(com.joaomgcd.taskerm.helper.r.this, ioVar);
            }
        });
        return e0.a;
    }

    public static final o1 R3(r rVar, g gVar) {
        jk.p.i(gVar, "it");
        return new o1(rVar.h4(gVar), (net.dinglisch.android.taskerm.g) null, false, 6, (jk.h) null);
    }

    public static final o1 R4(r rVar, io ioVar) {
        jk.p.i(ioVar, "it");
        String l1 = ioVar.l1(rVar.q1());
        jk.p.h(l1, "makeTitleText(...)");
        return new o1(l1, (net.dinglisch.android.taskerm.g) null, false, 6, (jk.h) null);
    }

    public static final void S3(r rVar, int i2) {
        rVar.q1().Vc(i2);
    }

    public static final void S4(r rVar, io ioVar) {
        rVar.q1().E6(ioVar.C0(), true);
    }

    public static final CharSequence U3(r rVar, io ioVar) {
        jk.p.i(ioVar, "it");
        return "- " + ioVar.l1(rVar.q1());
    }

    public static final e0 U4(final r rVar, g0 g0Var) {
        p1 a2;
        try {
            a2 = ((h8) l1.v(new df.l(rVar.q1(), new ik.a() {
                @Override
                public final Object e() {
                    ti.r V4;
                    V4 = com.joaomgcd.taskerm.helper.r.V4(com.joaomgcd.taskerm.helper.r.this);
                    return V4;
                }
            }, Integer.valueOf(com.joaomgcd.taskerm.util.ni.c(rVar.q1(), 200)), (Integer) null, b7.a6(2131890712, rVar.q1()), l7.C(b7.j6(2131889391, rVar.q1(), new Object[0])), b7.a6(2131886894, rVar.q1()), b7.a6(2131886870, rVar.q1()), b7.a6(2131886905, rVar.q1()), (Boolean) null, (Integer) null, 1544, (jk.h) null)).f()).a();
        } catch (Throwable th2) {
            e2.R1(rVar.q1(), th2);
        }
        if (a2.o()) {
            rg.i.B(rVar.R(), g0Var);
            ExtensionsContextKt.X(rVar.q1());
            return e0.a;
        }
        if (a2.n()) {
            rg.i.B(rVar.R(), g0Var);
            com.joaomgcd.taskerm.dialog.a.X3(rVar.q1(), b7.j6(2131890713, rVar.q1(), new Object[0]), b7.j6(2131889392, rVar.q1(), new Object[0]), (com.joaomgcd.taskerm.util.e0) null, (com.joaomgcd.taskerm.util.e0) null, 24, (Object) null).f();
            return e0.a;
        }
        return e0.a;
    }

    public static final ti.r V4(r rVar) {
        ti.r w = ti.r.w(BitmapFactory.decodeResource(rVar.q1().getResources(), 2131232639));
        jk.p.h(w, "just(...)");
        return w;
    }

    public static final e0 W3(ik.a aVar, int[] iArr) {
        jk.p.i(iArr, "it");
        aVar.e();
        return e0.a;
    }

    private final void X4() {
        q1().Ic(new Intent(R(), (Class<?>) ActivityAIChat.class), 33);
    }

    public static final e0 Y3(final r rVar) {
        w.b f2;
        Intent b2;
        try {
            f2 = gg.w.m.z(rVar.q1()).f();
        } catch (Exception e2) {
            o7.g("T", "Can't check license", e2);
        }
        if (f2.a()) {
            return e0.a;
        }
        if (!ExtensionsContextKt.H3(rVar.q1())) {
            b7.n6(null, new ik.a() {
                @Override
                public final Object e() {
                    df.p1 Z3;
                    Z3 = com.joaomgcd.taskerm.helper.r.Z3(com.joaomgcd.taskerm.helper.r.this);
                    return Z3;
                }
            }, 1, null);
        }
        try {
            if (rVar.q1().A() && (b2 = f2.b()) != null) {
                ExtensionsContextKt.t4(rVar.q1(), new xe(b2, false, 0, null, 14, null));
            }
        } catch (Exception e3) {
            h5.n(e3, rVar.q1());
        }
        rVar.q1().finish();
        return e0.a;
    }

    public static final p1 Z3(r rVar) {
        return (p1) com.joaomgcd.taskerm.dialog.a.R3(rVar.q1(), 2131888406, 2131888392).f();
    }

    private final void Z4() {
        q1().Ic(Settings.D1(q1(), false, -1), 3);
    }

    public static final e0 d4(r rVar, Runnable runnable) {
        rVar.A4("init ended async");
        runnable.run();
        return e0.a;
    }

    private final fo f4() {
        fo foVar = q1().S;
        jk.p.h(foVar, "data");
        return foVar;
    }

    private final String h4(g gVar) {
        String G0;
        String j6;
        fn b2 = gVar.b();
        if (b2.x()) {
            String name = b2.getName();
            jk.p.f(name);
            return name;
        }
        io ioVar = (io) kotlin.collections.t.g0(b7.V3(f4(), Integer.valueOf(b2.P0())));
        String Z0 = (ioVar == null || (G0 = ioVar.G0(q1())) == null || (j6 = b7.j6(2131891060, q1(), G0)) == null) ? b2.Z0() : j6;
        jk.p.f(Z0);
        return Z0;
    }

    private final List<g> k4(int[] iArr) {
        g gVar;
        Set<Integer> S1 = f4().S1();
        jk.p.h(S1, "getMacroIDSet(...)");
        Set<Integer> set = S1;
        ArrayList<fn> arrayList = new ArrayList(kotlin.collections.t.w(set, 10));
        for (Integer num : set) {
            fo f4 = f4();
            jk.p.f(num);
            arrayList.add(f4.T(num.intValue()));
        }
        ArrayList arrayList2 = new ArrayList(iArr.length);
        for (int i2 : iArr) {
            fn T = f4().T(i2);
            ArrayList arrayList3 = new ArrayList();
            for (fn fnVar : arrayList) {
                List<net.dinglisch.android.taskerm.c> D0 = fnVar.D0();
                jk.p.h(D0, "getActions(...)");
                ArrayList arrayList4 = new ArrayList();
                for (Object obj : D0) {
                    net.dinglisch.android.taskerm.c cVar = (net.dinglisch.android.taskerm.c) obj;
                    if (cVar.j() == 130 && jk.p.d(cVar.N(0).w(), T.getName())) {
                        arrayList4.add(obj);
                    }
                }
                if (arrayList4.isEmpty()) {
                    gVar = null;
                } else {
                    jk.p.f(T);
                    jk.p.f(fnVar);
                    gVar = new g(T, fnVar, arrayList4);
                }
                if (gVar != null) {
                    arrayList3.add(gVar);
                }
            }
            arrayList2.add(arrayList3);
        }
        return kotlin.collections.t.x(arrayList2);
    }

    public static final e0 o4(r rVar) {
        f fVar = (f) x0.j0(rVar.q1(), "TV Options", f.class, i.i, j.i).f();
        int i2 = fVar == null ? -1 : h.a[fVar.ordinal()];
        if (i2 != -1) {
            if (i2 == 1) {
                rVar.Z4();
            } else if (i2 == 2) {
                rVar.q1().u5();
            } else if (i2 == 3) {
                rVar.q1().J5();
            } else {
                if (i2 != 4) {
                    throw new vj.o();
                }
                rVar.q1().Pc(false, false);
            }
        }
        return e0.a;
    }

    public static ti.r t4(r rVar, boolean z, int i2, Object obj) {
        if ((i2 & 1) != 0) {
            z = false;
        }
        return rVar.s4(z);
    }

    public static final boolean u4(r rVar, boolean z) {
        pe peVar;
        String g1 = ExtensionsContextKt.g1(rVar.q1());
        if (g1 == null) {
            return false;
        }
        boolean y0 = l7.y0(g1);
        boolean i2 = com.joaomgcd.taskerm.datashare.export.a.a.i(g1);
        if (!y0 && !i2) {
            return false;
        }
        if (z && !((p1) com.joaomgcd.taskerm.dialog.a.N7(rVar.q1(), 2131888300, 2131887382, 0, 8, (Object) null).f()).o()) {
            return false;
        }
        if (y0) {
            peVar = (pe) com.joaomgcd.taskerm.datashare.export.d.v0(rVar.q1(), g1, new ik.l() {
                @Override
                public final Object invoke(Object obj) {
                    vj.e0 v4;
                    v4 = com.joaomgcd.taskerm.helper.r.v4((String) obj);
                    return v4;
                }
            }).f();
        } else {
            if (!i2) {
                return false;
            }
            peVar = (pe) com.joaomgcd.taskerm.datashare.export.d.h0(rVar.q1(), false, g1, true, false, false, new ik.l() {
                @Override
                public final Object invoke(Object obj) {
                    vj.e0 w4;
                    w4 = com.joaomgcd.taskerm.helper.r.w4((String) obj);
                    return w4;
                }
            }, 48, (Object) null).f();
        }
        return peVar.b();
    }

    public static final e0 v4(String str) {
        jk.p.i(str, "it");
        return e0.a;
    }

    public static final e0 w4(String str) {
        jk.p.i(str, "it");
        return e0.a;
    }

    public static final sj.a y4() {
        return sj.a.L();
    }

    public final ti.r<Integer> B3(final int i2, final boolean z, final int i3) {
        ti.r w7 = com.joaomgcd.taskerm.dialog.a.w7(new df.r(q1(), 2131888247, "1", 0, 0, 0, true, 16385, (String) null, 0, (Integer) null, 1848, (jk.h) null));
        final ik.l lVar = new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                Integer C3;
                C3 = com.joaomgcd.taskerm.helper.r.C3(z, i2, i3, (df.p1) obj);
                return C3;
            }
        };
        ti.r<Integer> x = w7.x(new yi.e() {
            @Override
            public final Object a(Object obj) {
                Integer D3;
                D3 = com.joaomgcd.taskerm.helper.r.D3(ik.l.this, obj);
                return D3;
            }
        });
        jk.p.h(x, "map(...)");
        return x;
    }

    public final void B4(final List<? extends Object> list) {
        jk.p.i(list, "taskerProfiles");
        K4(b2.a.Profile, new ik.a() {
            @Override
            public final Object e() {
                List C4;
                C4 = com.joaomgcd.taskerm.helper.r.C4(list);
                return C4;
            }
        }, new ik.p() {
            @Override
            public final Object n(Object obj, Object obj2) {
                vj.e0 D4;
                D4 = com.joaomgcd.taskerm.helper.r.D4(com.joaomgcd.taskerm.helper.r.this, ((Integer) obj).intValue(), ((Integer) obj2).intValue());
                return D4;
            }
        });
    }

    public final void E3(final String str, String str2) {
        if (str == null || str2 == null) {
            return;
        }
        Pair<StructureType, of> b2 = StructureType.Companion.b(str2);
        final StructureType first = b2 != null ? b2.getFirst() : null;
        if (first == null) {
            com.joaomgcd.taskerm.structuredoutput.b.a.c(q1(), str, null);
        } else {
            if (com.joaomgcd.taskerm.structuredoutput.b.a.a(q1(), str) == first) {
                return;
            }
            com.joaomgcd.taskerm.dialog.a.u4(q1(), 2131886560, new g0(b7.j6(2131890698, R(), b7.j6(first.getStringResId(), R(), new Object[0]))), new ik.a() {
                @Override
                public final Object e() {
                    vj.e0 F3;
                    F3 = com.joaomgcd.taskerm.helper.r.F3(com.joaomgcd.taskerm.helper.r.this, str, first);
                    return F3;
                }
            });
        }
    }

    public final void E4(final List<? extends Object> list) {
        jk.p.i(list, "scenes");
        K4(b2.a.Scene, new ik.a() {
            @Override
            public final Object e() {
                List F4;
                F4 = com.joaomgcd.taskerm.helper.r.F4(list);
                return F4;
            }
        }, new ik.p() {
            @Override
            public final Object n(Object obj, Object obj2) {
                vj.e0 G4;
                G4 = com.joaomgcd.taskerm.helper.r.G4(com.joaomgcd.taskerm.helper.r.this, (String) obj, ((Integer) obj2).intValue());
                return G4;
            }
        });
    }

    public final void G3() {
        Main q1 = q1();
        fo foVar = q1().S;
        jk.p.h(foVar, "data");
        e2.C2(com.joaomgcd.taskerm.dialog.a.e5(q1, foVar, 2131891246, (List) null, 8, (Object) null), q1(), new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                vj.e0 H3;
                H3 = com.joaomgcd.taskerm.helper.r.H3(com.joaomgcd.taskerm.helper.r.this, (Pair) obj);
                return H3;
            }
        });
    }

    public final void H4(final List<? extends Object> list) {
        jk.p.i(list, "tasks");
        K4(b2.a.Task, new ik.a() {
            @Override
            public final Object e() {
                List I4;
                I4 = com.joaomgcd.taskerm.helper.r.I4(list);
                return I4;
            }
        }, new ik.p() {
            @Override
            public final Object n(Object obj, Object obj2) {
                vj.e0 J4;
                J4 = com.joaomgcd.taskerm.helper.r.J4(com.joaomgcd.taskerm.helper.r.this, ((Integer) obj).intValue(), ((Integer) obj2).intValue());
                return J4;
            }
        });
    }

    public final int I3(int i2, int i3) {
        return !q1().N7() ? i2 : (i3 - i2) - 1;
    }

    public final boolean J3(final int[] iArr, final boolean z, boolean z2, final ik.l<? super int[], e0> lVar) {
        jk.p.i(iArr, "ids");
        jk.p.i(lVar, "handleDelete");
        List<g> k4 = k4(iArr);
        if (k4.isEmpty()) {
            return true;
        }
        final ik.l lVar2 = new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                e0 K3;
                K3 = r.K3(r.this, (r.g) obj);
                return K3;
            }
        };
        ArrayList arrayList = new ArrayList(iArr.length);
        for (int i2 : iArr) {
            arrayList.add(Integer.valueOf(f4().H(i2)));
        }
        List Y = kotlin.collections.t.Y(arrayList);
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        for (Object obj : k4) {
            Integer valueOf = Integer.valueOf(((g) obj).a().n1(f4()));
            Object obj2 = linkedHashMap.get(valueOf);
            if (obj2 == null) {
                obj2 = new ArrayList();
                linkedHashMap.put(valueOf, obj2);
            }
            ((List) obj2).add(obj);
        }
        List O0 = kotlin.collections.t.O0(linkedHashMap.keySet());
        if (!z2 && Y.size() == 1 && O0.size() == 1 && ((Number) Y.get(0)).intValue() == ((Number) O0.get(0)).intValue()) {
            return true;
        }
        LinkedHashMap linkedHashMap2 = new LinkedHashMap();
        for (Object obj3 : k4) {
            fn a2 = ((g) obj3).a();
            Object obj4 = linkedHashMap2.get(a2);
            if (obj4 == null) {
                obj4 = new ArrayList();
                linkedHashMap2.put(a2, obj4);
            }
            ((List) obj4).add(obj3);
        }
        final ArrayList arrayList2 = new ArrayList(linkedHashMap2.size());
        for (Map.Entry entry : linkedHashMap2.entrySet()) {
            arrayList2.add(new Pair(entry.getKey(), entry.getValue()));
        }
        M(new ik.a() {
            @Override
            public final Object e() {
                vj.e0 L3;
                L3 = com.joaomgcd.taskerm.helper.r.L3(iArr, z, arrayList2, lVar2, this, lVar);
                return L3;
            }
        });
        return false;
    }

    public final void N4() {
        ExtensionsContextKt.e0(R(), "https://forum.joaoapps.com/index.php?resources", true, false, true, 4, null);
    }

    public final void O4() {
        this.m.f(e0.a);
    }

    public final void P4(fn fnVar) {
        jk.p.i(fnVar, "task");
        final List<io> W3 = b7.W3(f4(), fnVar);
        if (W3 == null || W3.isEmpty()) {
            l7.d1(2131890723, q1());
        } else {
            M(new ik.a() {
                @Override
                public final Object e() {
                    vj.e0 Q4;
                    Q4 = com.joaomgcd.taskerm.helper.r.Q4(W3, this);
                    return Q4;
                }
            });
        }
    }

    public final boolean T3(int[] iArr) {
        jk.p.i(iArr, "ids");
        for (int i2 : iArr) {
            List<io> V3 = b7.V3(f4(), Integer.valueOf(i2));
            int size = V3.size();
            if (size != 0) {
                com.joaomgcd.taskerm.helper.j.t0(this, com.joaomgcd.taskerm.dialog.a.S3(q1(), 2131891186, b7.j6(2131887887, q1(), Integer.valueOf(size)) + "\n\n" + kotlin.collections.t.n0(V3, "\n", null, null, 0, null, new ik.l() {
                    @Override
                    public final Object invoke(Object obj) {
                        CharSequence U3;
                        U3 = com.joaomgcd.taskerm.helper.r.U3(com.joaomgcd.taskerm.helper.r.this, (io) obj);
                        return U3;
                    }
                }, 30, null)), null, 2, null);
                return false;
            }
        }
        return true;
    }

    @SuppressLint({"CheckResult"})
    public final boolean T4() {
        final g0 B = l7.B("showpatreondialog");
        if (rg.i.A(R(), B, null, 2, null) || ExtensionsContextKt.u1(q1()) < 30 || f4().d2() < 10 || f4().g2() < 15 || f4().e2() < 3) {
            return false;
        }
        M(new ik.a() {
            @Override
            public final Object e() {
                vj.e0 U4;
                U4 = com.joaomgcd.taskerm.helper.r.U4(com.joaomgcd.taskerm.helper.r.this, B);
                return U4;
            }
        });
        return true;
    }

    public final boolean V3(int i2, final ik.a<e0> aVar) {
        jk.p.i(aVar, "handleDelete");
        Set<Integer> I = f4().w(i2).I();
        jk.p.f(I);
        return J3(kotlin.collections.t.N0(I), true, false, new ik.l() {
            @Override
            public final Object invoke(Object obj) {
                vj.e0 W3;
                W3 = com.joaomgcd.taskerm.helper.r.W3(ik.a.this, (int[]) obj);
                return W3;
            }
        });
    }

    public final void W4(int i2, pi piVar) {
        jk.p.i(piVar, "project");
        sg.d.s.a(q1(), new k(piVar, this), i2, piVar).m(q1());
    }

    public final void X3() {
        M(new ik.a() {
            @Override
            public final Object e() {
                vj.e0 Y3;
                Y3 = com.joaomgcd.taskerm.helper.r.Y3(com.joaomgcd.taskerm.helper.r.this);
                return Y3;
            }
        });
    }

    public final void Y4() {
        A4("starting init");
        this.l.a();
    }

    public final void a4() {
        EditText editText = q1().B;
        if (editText != null) {
            editText.setText("");
        }
    }

    public final void a5() {
        if (e2.T1()) {
            throw new IllegalStateException("Can't run waitForInitEnd on UI Thread");
        }
        A4("waiting for init to end sync");
        this.l.getValue().h();
        A4("init ended sync");
    }

    public final void b4() {
        List<io> s2 = f4().s2(q1().C5());
        jk.p.h(s2, "getProfilesInProject(...)");
        for (io ioVar : kotlin.collections.t.b0(s2)) {
            if (!ioVar.f1()) {
                ioVar.K1();
            }
        }
    }

    public final void c4(final Runnable runnable) {
        jk.p.i(runnable, "runnable");
        if (!z4()) {
            A4("don't need to wait for init to end async");
            runnable.run();
        } else {
            A4("waiting for init to end async");
            sj.a value = this.l.getValue();
            jk.p.h(value, "<get-value>(...)");
            n0(e2.c2(value), new ik.a() {
                @Override
                public final Object e() {
                    vj.e0 d4;
                    d4 = com.joaomgcd.taskerm.helper.r.d4(com.joaomgcd.taskerm.helper.r.this, runnable);
                    return d4;
                }
            });
        }
    }

    public final void e4() {
        A4("ending init");
        this.l.getValue().a();
    }

    @Override
    public void g0() {
        super.g0();
        ti.n<e0> Y = this.m.o(250L, TimeUnit.MILLISECONDS).Y(vi.a.b());
        jk.p.h(Y, "observeOn(...)");
        l0(Y, new yi.d() {
            @Override
            public final void accept(Object obj) {
                com.joaomgcd.taskerm.helper.r.M4(com.joaomgcd.taskerm.helper.r.this, (vj.e0) obj);
            }
        });
    }

    public final boolean g4() {
        Editable text;
        String obj;
        EditText editText = q1().B;
        if (editText == null || (text = editText.getText()) == null || (obj = text.toString()) == null) {
            return false;
        }
        return l7.x0(obj);
    }

    public final void i4() {
        ExtensionsContextKt.W(q1());
    }

    public final Class<? extends Activity> j4() {
        return d1.z(q1()) ? ActivityEditTask2024.class : MacroEdit.class;
    }

    public final void l4() {
        X4();
    }

    public final void m4(Intent intent) {
        if (q1().n6("handleGenerateResult") == null) {
            return;
        }
        q1().K6(false, b2.a.Profile, b2.a.Task);
        q1().I7();
    }

    public final boolean n4() {
        if (ExtensionsContextKt.J3(q1())) {
            M(new ik.a() {
                @Override
                public final Object e() {
                    vj.e0 o4;
                    o4 = com.joaomgcd.taskerm.helper.r.o4(com.joaomgcd.taskerm.helper.r.this);
                    return o4;
                }
            });
            return true;
        }
        X4();
        return true;
    }

    public final boolean p4(int i2, KeyEvent keyEvent) {
        jk.p.i(keyEvent, "event");
        if (!keyEvent.isCtrlPressed() || i2 != 50) {
            return false;
        }
        com.joaomgcd.taskerm.helper.j.t0(this, t4(this, false, 1, null), null, 2, null);
        return true;
    }

    public final void q4() {
        ImageView imageView = q1().L;
        if (imageView == null) {
            return;
        }
        imageView.setVisibility(d1.c(q1()) ? 0 : 8);
    }

    public final void r4() {
        com.joaomgcd.taskerm.helper.j.s0(this, ExtensionsContextKt.n0(R(), ActivityReceiveShare.class, !hf.g.l.b(R()).isEmpty()), null, 2, null);
    }

    public final ti.r<Boolean> s4(final boolean z) {
        return a0(new ik.a() {
            @Override
            public final Object e() {
                boolean u4;
                u4 = com.joaomgcd.taskerm.helper.r.u4(com.joaomgcd.taskerm.helper.r.this, z);
                return Boolean.valueOf(u4);
            }
        });
    }

    public final void x4() {
        ExtensionsContextKt.e0(R(), "https://taskernet.com/?public", true, false, true, 4, null);
    }

    public final boolean z4() {
        return !this.l.getValue().M();
    }
}