package l0;

import android.view.KeyEvent;

/* loaded from: classes.dex */
public abstract class t {

    /* renamed from: a, reason: collision with root package name */
    private static final s f27210a = new c(a(new kotlin.jvm.internal.g0() { // from class: l0.t.b
        @Override // kotlin.jvm.internal.g0, kn.n
        public Object get(Object obj) {
            return Boolean.valueOf(b2.d.e(((b2.b) obj).f()));
        }
    }));

    /* loaded from: classes.dex */
    public static final class a implements s {

        /* renamed from: a, reason: collision with root package name */
        final /* synthetic */ dn.l f27211a;

        a(dn.l lVar) {
            this.f27211a = lVar;
        }

        @Override // l0.s
        public q a(KeyEvent keyEvent) {
            if (((Boolean) this.f27211a.invoke(b2.b.a(keyEvent))).booleanValue() && b2.d.f(keyEvent)) {
                if (b2.a.p(b2.d.a(keyEvent), d0.f26834a.x())) {
                    return q.REDO;
                }
                return null;
            }
            if (((Boolean) this.f27211a.invoke(b2.b.a(keyEvent))).booleanValue()) {
                long a10 = b2.d.a(keyEvent);
                d0 d0Var = d0.f26834a;
                if (b2.a.p(a10, d0Var.d()) ? true : b2.a.p(a10, d0Var.n())) {
                    return q.COPY;
                }
                if (b2.a.p(a10, d0Var.u())) {
                    return q.PASTE;
                }
                if (b2.a.p(a10, d0Var.v())) {
                    return q.CUT;
                }
                if (b2.a.p(a10, d0Var.a())) {
                    return q.SELECT_ALL;
                }
                if (b2.a.p(a10, d0Var.w())) {
                    return q.REDO;
                }
                if (b2.a.p(a10, d0Var.x())) {
                    return q.UNDO;
                }
                return null;
            }
            if (b2.d.e(keyEvent)) {
                return null;
            }
            if (b2.d.f(keyEvent)) {
                long a11 = b2.d.a(keyEvent);
                d0 d0Var2 = d0.f26834a;
                if (b2.a.p(a11, d0Var2.i())) {
                    return q.SELECT_LEFT_CHAR;
                }
                if (b2.a.p(a11, d0Var2.j())) {
                    return q.SELECT_RIGHT_CHAR;
                }
                if (b2.a.p(a11, d0Var2.k())) {
                    return q.SELECT_UP;
                }
                if (b2.a.p(a11, d0Var2.h())) {
                    return q.SELECT_DOWN;
                }
                if (b2.a.p(a11, d0Var2.r())) {
                    return q.SELECT_PAGE_UP;
                }
                if (b2.a.p(a11, d0Var2.q())) {
                    return q.SELECT_PAGE_DOWN;
                }
                if (b2.a.p(a11, d0Var2.p())) {
                    return q.SELECT_LINE_START;
                }
                if (b2.a.p(a11, d0Var2.o())) {
                    return q.SELECT_LINE_END;
                }
                if (b2.a.p(a11, d0Var2.n())) {
                    return q.PASTE;
                }
                return null;
            }
            long a12 = b2.d.a(keyEvent);
            d0 d0Var3 = d0.f26834a;
            if (b2.a.p(a12, d0Var3.i())) {
                return q.LEFT_CHAR;
            }
            if (b2.a.p(a12, d0Var3.j())) {
                return q.RIGHT_CHAR;
            }
            if (b2.a.p(a12, d0Var3.k())) {
                return q.UP;
            }
            if (b2.a.p(a12, d0Var3.h())) {
                return q.DOWN;
            }
            if (b2.a.p(a12, d0Var3.r())) {
                return q.PAGE_UP;
            }
            if (b2.a.p(a12, d0Var3.q())) {
                return q.PAGE_DOWN;
            }
            if (b2.a.p(a12, d0Var3.p())) {
                return q.LINE_START;
            }
            if (b2.a.p(a12, d0Var3.o())) {
                return q.LINE_END;
            }
            if (b2.a.p(a12, d0Var3.l())) {
                return q.NEW_LINE;
            }
            if (b2.a.p(a12, d0Var3.c())) {
                return q.DELETE_PREV_CHAR;
            }
            if (b2.a.p(a12, d0Var3.g())) {
                return q.DELETE_NEXT_CHAR;
            }
            if (b2.a.p(a12, d0Var3.s())) {
                return q.PASTE;
            }
            if (b2.a.p(a12, d0Var3.f())) {
                return q.CUT;
            }
            if (b2.a.p(a12, d0Var3.e())) {
                return q.COPY;
            }
            if (b2.a.p(a12, d0Var3.t())) {
                return q.TAB;
            }
            return null;
        }
    }

    /* loaded from: classes.dex */
    public static final class c implements s {

        /* renamed from: a, reason: collision with root package name */
        final /* synthetic */ s f27213a;

        c(s sVar) {
            this.f27213a = sVar;
        }

        @Override // l0.s
        public q a(KeyEvent keyEvent) {
            q qVar = null;
            if (b2.d.f(keyEvent) && b2.d.e(keyEvent)) {
                long a10 = b2.d.a(keyEvent);
                d0 d0Var = d0.f26834a;
                if (b2.a.p(a10, d0Var.i())) {
                    qVar = q.SELECT_LEFT_WORD;
                } else if (b2.a.p(a10, d0Var.j())) {
                    qVar = q.SELECT_RIGHT_WORD;
                } else if (b2.a.p(a10, d0Var.k())) {
                    qVar = q.SELECT_PREV_PARAGRAPH;
                } else if (b2.a.p(a10, d0Var.h())) {
                    qVar = q.SELECT_NEXT_PARAGRAPH;
                }
            } else if (b2.d.e(keyEvent)) {
                long a11 = b2.d.a(keyEvent);
                d0 d0Var2 = d0.f26834a;
                if (b2.a.p(a11, d0Var2.i())) {
                    qVar = q.LEFT_WORD;
                } else if (b2.a.p(a11, d0Var2.j())) {
                    qVar = q.RIGHT_WORD;
                } else if (b2.a.p(a11, d0Var2.k())) {
                    qVar = q.PREV_PARAGRAPH;
                } else if (b2.a.p(a11, d0Var2.h())) {
                    qVar = q.NEXT_PARAGRAPH;
                } else if (b2.a.p(a11, d0Var2.m())) {
                    qVar = q.DELETE_PREV_CHAR;
                } else if (b2.a.p(a11, d0Var2.g())) {
                    qVar = q.DELETE_NEXT_WORD;
                } else if (b2.a.p(a11, d0Var2.c())) {
                    qVar = q.DELETE_PREV_WORD;
                } else if (b2.a.p(a11, d0Var2.b())) {
                    qVar = q.DESELECT;
                }
            } else if (b2.d.f(keyEvent)) {
                long a12 = b2.d.a(keyEvent);
                d0 d0Var3 = d0.f26834a;
                if (b2.a.p(a12, d0Var3.p())) {
                    qVar = q.SELECT_LINE_LEFT;
                } else if (b2.a.p(a12, d0Var3.o())) {
                    qVar = q.SELECT_LINE_RIGHT;
                }
            } else if (b2.d.d(keyEvent)) {
                long a13 = b2.d.a(keyEvent);
                d0 d0Var4 = d0.f26834a;
                if (b2.a.p(a13, d0Var4.c())) {
                    qVar = q.DELETE_FROM_LINE_START;
                } else if (b2.a.p(a13, d0Var4.g())) {
                    qVar = q.DELETE_TO_LINE_END;
                }
            }
            return qVar == null ? this.f27213a.a(keyEvent) : qVar;
        }
    }

    public static final s a(dn.l lVar) {
        return new a(lVar);
    }

    public static final s b() {
        return f27210a;
    }
}
