// Code generated by cmd/genactions; DO NOT EDIT.
package actions

import (
	"github.com/idursun/jjui/internal/ui/actionargs"
	keybindings "github.com/idursun/jjui/internal/ui/bindings"
	"github.com/idursun/jjui/internal/ui/intents"
)

const (
	ScopeBookmarks           = "bookmarks"
	ScopeChoose              = "choose"
	ScopeCommandHistory      = "command_history"
	ScopeDiff                = "diff"
	ScopeFileSearch          = "file_search"
	ScopeGit                 = "git"
	ScopeHelp                = "help"
	ScopeInput               = "input"
	ScopeOplog               = "oplog"
	ScopeOplogQuickSearch    = "oplog.quick_search"
	ScopePassword            = "password"
	ScopeRedo                = "redo"
	ScopeRevisions           = "revisions"
	ScopeAbandon             = "revisions.abandon"
	ScopeAbsorb              = "revisions.absorb"
	ScopeAceJump             = "revisions.ace_jump"
	ScopeDetails             = "revisions.details"
	ScopeDetailsConfirmation = "revisions.details.confirmation"
	ScopeDiffRange           = "revisions.diff_range"
	ScopeDuplicate           = "revisions.duplicate"
	ScopeEvolog              = "revisions.evolog"
	ScopeInlineDescribe      = "revisions.inline_describe"
	ScopeNewBetween          = "revisions.new_between"
	ScopeQuickSearch         = "revisions.quick_search"
	ScopeQuickSearchInput    = "revisions.quick_search.input"
	ScopeRebase              = "revisions.rebase"
	ScopeRevert              = "revisions.revert"
	ScopeSetBookmark         = "revisions.set_bookmark"
	ScopeSetParents          = "revisions.set_parents"
	ScopeSquash              = "revisions.squash"
	ScopeTargetPicker        = "revisions.target_picker"
	ScopeRevset              = "revset"
	ScopeStatusInput         = "status.input"
	ScopeUi                  = "ui"
	ScopeUiPreview           = "ui.preview"
	ScopeUndo                = "undo"
)

func ResolveIntent(scope string, action keybindings.Action, args map[string]any) (intents.Intent, bool) {
	switch scope {
	case ScopeBookmarks:
		switch action {
		case keybindings.Action("bookmarks.apply"):
			return intents.Apply{}, true
		case keybindings.Action("bookmarks.bookmark_delete"):
			return intents.BookmarksFilter{Kind: intents.BookmarksFilterDelete}, true
		case keybindings.Action("bookmarks.bookmark_forget"):
			return intents.BookmarksFilter{Kind: intents.BookmarksFilterForget}, true
		case keybindings.Action("bookmarks.bookmark_move"):
			return intents.BookmarksFilter{Kind: intents.BookmarksFilterMove}, true
		case keybindings.Action("bookmarks.bookmark_track"):
			return intents.BookmarksFilter{Kind: intents.BookmarksFilterTrack}, true
		case keybindings.Action("bookmarks.bookmark_untrack"):
			return intents.BookmarksFilter{Kind: intents.BookmarksFilterUntrack}, true
		case keybindings.Action("bookmarks.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("bookmarks.cycle_remotes"):
			return intents.BookmarksCycleRemotes{Delta: 1}, true
		case keybindings.Action("bookmarks.cycle_remotes_back"):
			return intents.BookmarksCycleRemotes{Delta: -1}, true
		case keybindings.Action("bookmarks.filter"):
			return intents.BookmarksOpenFilter{}, true
		case keybindings.Action("bookmarks.move_down"):
			return intents.BookmarksNavigate{Delta: 1}, true
		case keybindings.Action("bookmarks.move_up"):
			return intents.BookmarksNavigate{Delta: -1}, true
		case keybindings.Action("bookmarks.page_down"):
			return intents.BookmarksNavigate{Delta: 1, IsPage: true}, true
		case keybindings.Action("bookmarks.page_up"):
			return intents.BookmarksNavigate{Delta: -1, IsPage: true}, true
		case keybindings.Action("bookmarks.quit"):
			return intents.Quit{}, true
		}
	case ScopeChoose:
		switch action {
		case keybindings.Action("choose.apply"):
			return intents.ChooseApply{}, true
		case keybindings.Action("choose.cancel"):
			return intents.ChooseCancel{}, true
		case keybindings.Action("choose.move_down"):
			return intents.ChooseNavigate{Delta: 1}, true
		case keybindings.Action("choose.move_up"):
			return intents.ChooseNavigate{Delta: -1}, true
		}
	case ScopeCommandHistory:
		switch action {
		case keybindings.Action("command_history.close"):
			return intents.CommandHistoryClose{}, true
		case keybindings.Action("command_history.delete_selected"):
			return intents.CommandHistoryDeleteSelected{}, true
		case keybindings.Action("command_history.move_down"):
			return intents.CommandHistoryNavigate{Delta: 1}, true
		case keybindings.Action("command_history.move_up"):
			return intents.CommandHistoryNavigate{Delta: -1}, true
		}
	case ScopeDiff:
		switch action {
		case keybindings.Action("diff.half_page_down"):
			return intents.DiffScroll{Kind: intents.DiffHalfPageDown}, true
		case keybindings.Action("diff.half_page_up"):
			return intents.DiffScroll{Kind: intents.DiffHalfPageUp}, true
		case keybindings.Action("diff.left"):
			return intents.DiffScrollHorizontal{Kind: intents.DiffScrollLeft}, true
		case keybindings.Action("diff.move_bottom"):
			return intents.DiffScroll{Kind: intents.DiffMoveBottom}, true
		case keybindings.Action("diff.move_top"):
			return intents.DiffScroll{Kind: intents.DiffMoveTop}, true
		case keybindings.Action("diff.page_down"):
			return intents.DiffScroll{Kind: intents.DiffPageDown}, true
		case keybindings.Action("diff.page_up"):
			return intents.DiffScroll{Kind: intents.DiffPageUp}, true
		case keybindings.Action("diff.right"):
			return intents.DiffScrollHorizontal{Kind: intents.DiffScrollRight}, true
		case keybindings.Action("diff.scroll_down"):
			return intents.DiffScroll{Kind: intents.DiffScrollDown}, true
		case keybindings.Action("diff.scroll_up"):
			return intents.DiffScroll{Kind: intents.DiffScrollUp}, true
		case keybindings.Action("diff.show"):
			return intents.DiffShow{Content: actionargs.StringArg(args, "content", "")}, true
		case keybindings.Action("diff.toggle_wrap"):
			return intents.DiffToggleWrap{}, true
		}
	case ScopeFileSearch:
		switch action {
		case keybindings.Action("file_search.apply"):
			return intents.Apply{}, true
		case keybindings.Action("file_search.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("file_search.edit"):
			return intents.FileSearchEdit{}, true
		case keybindings.Action("file_search.move_down"):
			return intents.FileSearchNavigate{Delta: -1}, true
		case keybindings.Action("file_search.move_up"):
			return intents.FileSearchNavigate{Delta: 1}, true
		case keybindings.Action("file_search.page_down"):
			return intents.FileSearchPreviewScroll{Kind: intents.PreviewPageDown}, true
		case keybindings.Action("file_search.page_up"):
			return intents.FileSearchPreviewScroll{Kind: intents.PreviewPageUp}, true
		case keybindings.Action("file_search.preview_half_page_down"):
			return intents.FileSearchPreviewScroll{Kind: intents.PreviewHalfPageDown}, true
		case keybindings.Action("file_search.preview_half_page_up"):
			return intents.FileSearchPreviewScroll{Kind: intents.PreviewHalfPageUp}, true
		case keybindings.Action("file_search.toggle"):
			return intents.FileSearchTogglePreview{}, true
		}
	case ScopeGit:
		switch action {
		case keybindings.Action("git.apply"):
			return intents.Apply{}, true
		case keybindings.Action("git.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("git.cycle_remotes"):
			return intents.GitCycleRemotes{Delta: 1}, true
		case keybindings.Action("git.cycle_remotes_back"):
			return intents.GitCycleRemotes{Delta: -1}, true
		case keybindings.Action("git.fetch"):
			return intents.GitFilter{Kind: intents.GitFilterFetch}, true
		case keybindings.Action("git.filter"):
			return intents.GitOpenFilter{}, true
		case keybindings.Action("git.move_down"):
			return intents.GitNavigate{Delta: 1}, true
		case keybindings.Action("git.move_up"):
			return intents.GitNavigate{Delta: -1}, true
		case keybindings.Action("git.page_down"):
			return intents.GitNavigate{Delta: 1, IsPage: true}, true
		case keybindings.Action("git.page_up"):
			return intents.GitNavigate{Delta: -1, IsPage: true}, true
		case keybindings.Action("git.push"):
			return intents.GitFilter{Kind: intents.GitFilterPush}, true
		case keybindings.Action("git.quit"):
			return intents.Quit{}, true
		}
	case ScopeHelp:
		switch action {
		case keybindings.Action("help.apply"):
			return intents.Apply{}, true
		case keybindings.Action("help.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("help.close"):
			return intents.HelpClose{}, true
		case keybindings.Action("help.filter"):
			return intents.HelpFilter{}, true
		case keybindings.Action("help.move_bottom"):
			return intents.HelpScroll{Delta: 999999}, true
		case keybindings.Action("help.move_top"):
			return intents.HelpScroll{Delta: 0}, true
		case keybindings.Action("help.page_down"):
			return intents.HelpScroll{Delta: 10}, true
		case keybindings.Action("help.page_up"):
			return intents.HelpScroll{Delta: -10}, true
		case keybindings.Action("help.scroll_down"):
			return intents.HelpScroll{Delta: 1}, true
		case keybindings.Action("help.scroll_up"):
			return intents.HelpScroll{Delta: -1}, true
		}
	case ScopeInput:
		switch action {
		case keybindings.Action("input.apply"):
			return intents.Apply{}, true
		case keybindings.Action("input.cancel"):
			return intents.Cancel{}, true
		}
	case ScopeOplog:
		switch action {
		case keybindings.Action("oplog.close"):
			return intents.OpLogClose{}, true
		case keybindings.Action("oplog.diff"):
			return intents.OpLogShowDiff{}, true
		case keybindings.Action("oplog.move_down"):
			return intents.OpLogNavigate{Delta: 1}, true
		case keybindings.Action("oplog.move_up"):
			return intents.OpLogNavigate{Delta: -1}, true
		case keybindings.Action("oplog.page_down"):
			return intents.OpLogNavigate{Delta: 1, IsPage: true}, true
		case keybindings.Action("oplog.page_up"):
			return intents.OpLogNavigate{Delta: -1, IsPage: true}, true
		case keybindings.Action("oplog.quit"):
			return intents.Quit{}, true
		case keybindings.Action("oplog.restore"):
			return intents.OpLogRestore{}, true
		case keybindings.Action("oplog.revert"):
			return intents.OpLogRevert{}, true
		}
	case ScopeOplogQuickSearch:
		switch action {
		case keybindings.Action("oplog.quick_search.clear"):
			return intents.OpLogQuickSearchClear{}, true
		case keybindings.Action("oplog.quick_search.next"):
			return intents.QuickSearchCycle{}, true
		case keybindings.Action("oplog.quick_search.prev"):
			return intents.QuickSearchCycle{Reverse: true}, true
		}
	case ScopePassword:
		switch action {
		case keybindings.Action("password.apply"):
			return intents.Apply{}, true
		case keybindings.Action("password.cancel"):
			return intents.Cancel{}, true
		}
	case ScopeRedo:
		switch action {
		case keybindings.Action("redo.apply"):
			return intents.Apply{}, true
		case keybindings.Action("redo.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("redo.next"):
			return intents.OptionSelect{Delta: 1}, true
		case keybindings.Action("redo.prev"):
			return intents.OptionSelect{Delta: -1}, true
		}
	case ScopeRevisions:
		switch action {
		case keybindings.Action("revisions.ace_jump"):
			return intents.StartAceJump{}, true
		case keybindings.Action("revisions.apply"):
			return intents.Apply{Force: actionargs.BoolArg(args, "force", false)}, true
		case keybindings.Action("revisions.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("revisions.commit"):
			return intents.CommitWorkingCopy{}, true
		case keybindings.Action("revisions.describe"):
			return intents.Describe{}, true
		case keybindings.Action("revisions.diff"):
			return intents.ShowDiff{}, true
		case keybindings.Action("revisions.diff_edit"):
			return intents.DiffEdit{}, true
		case keybindings.Action("revisions.edit"):
			return intents.StartEdit{}, true
		case keybindings.Action("revisions.force_apply"):
			return intents.Apply{Force: true}, true
		case keybindings.Action("revisions.force_edit"):
			return intents.StartEdit{IgnoreImmutable: true}, true
		case keybindings.Action("revisions.jump_to_children"):
			return intents.Navigate{Target: intents.TargetChild}, true
		case keybindings.Action("revisions.jump_to_parent"):
			return intents.Navigate{Target: intents.TargetParent}, true
		case keybindings.Action("revisions.jump_to_working_copy"):
			return intents.Navigate{Target: intents.TargetWorkingCopy}, true
		case keybindings.Action("revisions.move_down"):
			return intents.Navigate{Delta: 1}, true
		case keybindings.Action("revisions.move_up"):
			return intents.Navigate{Delta: -1}, true
		case keybindings.Action("revisions.new"):
			return intents.StartNew{}, true
		case keybindings.Action("revisions.open_abandon"):
			return intents.OpenAbandon{}, true
		case keybindings.Action("revisions.open_absorb"):
			return intents.OpenAbsorb{}, true
		case keybindings.Action("revisions.open_details"):
			return intents.OpenDetails{}, true
		case keybindings.Action("revisions.open_diff_range"):
			return intents.OpenDiffRange{}, true
		case keybindings.Action("revisions.open_duplicate"):
			return intents.OpenDuplicate{}, true
		case keybindings.Action("revisions.open_evolog"):
			return intents.OpenEvolog{}, true
		case keybindings.Action("revisions.open_inline_describe"):
			return intents.OpenInlineDescribe{}, true
		case keybindings.Action("revisions.open_new_between"):
			return intents.OpenNewBetween{}, true
		case keybindings.Action("revisions.open_rebase"):
			return intents.OpenRebase{}, true
		case keybindings.Action("revisions.open_revert"):
			return intents.OpenRevert{}, true
		case keybindings.Action("revisions.open_set_bookmark"):
			return intents.OpenSetBookmark{Value: actionargs.StringArg(args, "value", "")}, true
		case keybindings.Action("revisions.open_set_parents"):
			return intents.OpenSetParents{}, true
		case keybindings.Action("revisions.open_squash"):
			return intents.OpenSquash{}, true
		case keybindings.Action("revisions.page_down"):
			return intents.Navigate{Delta: 1, IsPage: true}, true
		case keybindings.Action("revisions.page_up"):
			return intents.Navigate{Delta: -1, IsPage: true}, true
		case keybindings.Action("revisions.refresh"):
			return intents.Refresh{}, true
		case keybindings.Action("revisions.split"):
			return intents.StartSplit{}, true
		case keybindings.Action("revisions.split_parallel"):
			return intents.StartSplit{IsParallel: true}, true
		case keybindings.Action("revisions.toggle_select"):
			return intents.RevisionsToggleSelect{}, true
		}
	case ScopeAbandon:
		switch action {
		case keybindings.Action("revisions.abandon.ace_jump"):
			return intents.StartAceJump{}, true
		case keybindings.Action("revisions.abandon.apply"):
			return intents.Apply{Force: actionargs.BoolArg(args, "force", false)}, true
		case keybindings.Action("revisions.abandon.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("revisions.abandon.force_apply"):
			return intents.Apply{Force: true}, true
		case keybindings.Action("revisions.abandon.jump_to_working_copy"):
			return intents.Navigate{Target: intents.TargetWorkingCopy}, true
		case keybindings.Action("revisions.abandon.select_descendants"):
			return intents.AbandonSelectDescendants{}, true
		case keybindings.Action("revisions.abandon.toggle_select"):
			return intents.AbandonToggleSelect{}, true
		}
	case ScopeAbsorb:
		switch action {
		case keybindings.Action("revisions.absorb.ace_jump"):
			return intents.StartAceJump{}, true
		case keybindings.Action("revisions.absorb.apply"):
			return intents.Apply{}, true
		case keybindings.Action("revisions.absorb.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("revisions.absorb.jump_to_working_copy"):
			return intents.Navigate{Target: intents.TargetWorkingCopy}, true
		case keybindings.Action("revisions.absorb.select_descendants"):
			return intents.AbsorbSelectDescendants{}, true
		case keybindings.Action("revisions.absorb.toggle_select"):
			return intents.AbsorbToggleSelect{}, true
		}
	case ScopeAceJump:
		switch action {
		case keybindings.Action("revisions.ace_jump.apply"):
			return intents.Apply{}, true
		case keybindings.Action("revisions.ace_jump.cancel"):
			return intents.Cancel{}, true
		}
	case ScopeDetails:
		switch action {
		case keybindings.Action("revisions.details.absorb"):
			return intents.DetailsAbsorb{}, true
		case keybindings.Action("revisions.details.cancel"):
			return intents.DetailsClose{}, true
		case keybindings.Action("revisions.details.diff"):
			return intents.DetailsDiff{}, true
		case keybindings.Action("revisions.details.move_down"):
			return intents.DetailsNavigate{Delta: 1}, true
		case keybindings.Action("revisions.details.move_up"):
			return intents.DetailsNavigate{Delta: -1}, true
		case keybindings.Action("revisions.details.page_down"):
			return intents.DetailsNavigate{Delta: 1, IsPage: true}, true
		case keybindings.Action("revisions.details.page_up"):
			return intents.DetailsNavigate{Delta: -1, IsPage: true}, true
		case keybindings.Action("revisions.details.quit"):
			return intents.Quit{}, true
		case keybindings.Action("revisions.details.refresh"):
			return intents.Refresh{}, true
		case keybindings.Action("revisions.details.restore"):
			return intents.DetailsRestore{}, true
		case keybindings.Action("revisions.details.revisions_changing_file"):
			return intents.DetailsRevisionsChangingFile{}, true
		case keybindings.Action("revisions.details.select_file"):
			return intents.DetailsSelectFile{File: actionargs.StringArg(args, "file", "")}, true
		case keybindings.Action("revisions.details.split"):
			return intents.DetailsSplit{}, true
		case keybindings.Action("revisions.details.split_parallel"):
			return intents.DetailsSplit{IsParallel: true}, true
		case keybindings.Action("revisions.details.squash"):
			return intents.DetailsSquash{}, true
		case keybindings.Action("revisions.details.toggle_select"):
			return intents.DetailsToggleSelect{}, true
		}
	case ScopeDetailsConfirmation:
		switch action {
		case keybindings.Action("revisions.details.confirmation.apply"):
			return intents.Apply{Force: actionargs.BoolArg(args, "force", false)}, true
		case keybindings.Action("revisions.details.confirmation.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("revisions.details.confirmation.force_apply"):
			return intents.Apply{Force: true}, true
		case keybindings.Action("revisions.details.confirmation.next"):
			return intents.OptionSelect{Delta: 1}, true
		case keybindings.Action("revisions.details.confirmation.prev"):
			return intents.OptionSelect{Delta: -1}, true
		}
	case ScopeDiffRange:
		switch action {
		case keybindings.Action("revisions.diff_range.apply"):
			return intents.Apply{}, true
		case keybindings.Action("revisions.diff_range.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("revisions.diff_range.swap"):
			return intents.DiffRangeSwap{}, true
		case keybindings.Action("revisions.diff_range.target_picker"):
			return intents.DiffRangeOpenTargetPicker{Target: enumArgDiffArgTarget(args, "target")}, true
		}
	case ScopeDuplicate:
		switch action {
		case keybindings.Action("revisions.duplicate.ace_jump"):
			return intents.StartAceJump{}, true
		case keybindings.Action("revisions.duplicate.apply"):
			return intents.Apply{Force: actionargs.BoolArg(args, "force", false)}, true
		case keybindings.Action("revisions.duplicate.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("revisions.duplicate.force_apply"):
			return intents.Apply{Force: true}, true
		case keybindings.Action("revisions.duplicate.jump_to_working_copy"):
			return intents.Navigate{Target: intents.TargetWorkingCopy}, true
		case keybindings.Action("revisions.duplicate.set_target"):
			return intents.DuplicateSetTarget{Target: enumArgModeTarget(args, "target")}, true
		case keybindings.Action("revisions.duplicate.target_picker"):
			return intents.DuplicateOpenTargetPicker{}, true
		}
	case ScopeEvolog:
		switch action {
		case keybindings.Action("revisions.evolog.apply"):
			return intents.Apply{Force: actionargs.BoolArg(args, "force", false)}, true
		case keybindings.Action("revisions.evolog.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("revisions.evolog.diff"):
			return intents.EvologDiff{}, true
		case keybindings.Action("revisions.evolog.move_down"):
			return intents.EvologNavigate{Delta: 1}, true
		case keybindings.Action("revisions.evolog.move_up"):
			return intents.EvologNavigate{Delta: -1}, true
		case keybindings.Action("revisions.evolog.page_down"):
			return intents.EvologNavigate{Delta: 1, IsPage: true}, true
		case keybindings.Action("revisions.evolog.page_up"):
			return intents.EvologNavigate{Delta: -1, IsPage: true}, true
		case keybindings.Action("revisions.evolog.quit"):
			return intents.Quit{}, true
		case keybindings.Action("revisions.evolog.restore"):
			return intents.EvologRestore{}, true
		}
	case ScopeInlineDescribe:
		switch action {
		case keybindings.Action("revisions.inline_describe.accept"):
			return intents.InlineDescribeAccept{Force: actionargs.BoolArg(args, "force", false)}, true
		case keybindings.Action("revisions.inline_describe.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("revisions.inline_describe.editor"):
			return intents.InlineDescribeEditor{}, true
		case keybindings.Action("revisions.inline_describe.force_accept"):
			return intents.InlineDescribeAccept{Force: true}, true
		case keybindings.Action("revisions.inline_describe.new_line"):
			return intents.InlineDescribeNewLine{}, true
		}
	case ScopeNewBetween:
		switch action {
		case keybindings.Action("revisions.new_between.apply"):
			return intents.Apply{}, true
		case keybindings.Action("revisions.new_between.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("revisions.new_between.toggle_insert_before"):
			return intents.NewBetweenToggleInsertBefore{}, true
		}
	case ScopeQuickSearch:
		switch action {
		case keybindings.Action("revisions.quick_search.clear"):
			return intents.RevisionsQuickSearchClear{}, true
		case keybindings.Action("revisions.quick_search.next"):
			return intents.QuickSearchCycle{}, true
		case keybindings.Action("revisions.quick_search.prev"):
			return intents.QuickSearchCycle{Reverse: true}, true
		}
	case ScopeQuickSearchInput:
		switch action {
		case keybindings.Action("revisions.quick_search.input.apply"):
			return intents.Apply{}, true
		case keybindings.Action("revisions.quick_search.input.cancel"):
			return intents.Cancel{}, true
		}
	case ScopeRebase:
		switch action {
		case keybindings.Action("revisions.rebase.ace_jump"):
			return intents.StartAceJump{}, true
		case keybindings.Action("revisions.rebase.apply"):
			return intents.Apply{Force: actionargs.BoolArg(args, "force", false)}, true
		case keybindings.Action("revisions.rebase.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("revisions.rebase.force_apply"):
			return intents.Apply{Force: true}, true
		case keybindings.Action("revisions.rebase.jump_to_working_copy"):
			return intents.Navigate{Target: intents.TargetWorkingCopy}, true
		case keybindings.Action("revisions.rebase.set_source"):
			return intents.RebaseSetSource{Source: enumArgRebaseSource(args, "source")}, true
		case keybindings.Action("revisions.rebase.set_target"):
			return intents.RebaseSetTarget{Target: enumArgModeTarget(args, "target")}, true
		case keybindings.Action("revisions.rebase.skip_emptied"):
			return intents.RebaseToggleSkipEmptied{}, true
		case keybindings.Action("revisions.rebase.target_picker"):
			return intents.RebaseOpenTargetPicker{}, true
		}
	case ScopeRevert:
		switch action {
		case keybindings.Action("revisions.revert.apply"):
			return intents.Apply{Force: actionargs.BoolArg(args, "force", false)}, true
		case keybindings.Action("revisions.revert.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("revisions.revert.force_apply"):
			return intents.Apply{Force: true}, true
		case keybindings.Action("revisions.revert.set_target"):
			return intents.RevertSetTarget{Target: enumArgModeTarget(args, "target")}, true
		case keybindings.Action("revisions.revert.target_picker"):
			return intents.RevertOpenTargetPicker{}, true
		}
	case ScopeSetBookmark:
		switch action {
		case keybindings.Action("revisions.set_bookmark.apply"):
			return intents.Apply{}, true
		case keybindings.Action("revisions.set_bookmark.autocomplete"):
			return intents.AutocompleteCycle{}, true
		case keybindings.Action("revisions.set_bookmark.autocomplete_back"):
			return intents.AutocompleteCycle{Reverse: true}, true
		case keybindings.Action("revisions.set_bookmark.cancel"):
			return intents.Cancel{}, true
		}
	case ScopeSetParents:
		switch action {
		case keybindings.Action("revisions.set_parents.ace_jump"):
			return intents.StartAceJump{}, true
		case keybindings.Action("revisions.set_parents.apply"):
			return intents.Apply{}, true
		case keybindings.Action("revisions.set_parents.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("revisions.set_parents.jump_to_working_copy"):
			return intents.Navigate{Target: intents.TargetWorkingCopy}, true
		case keybindings.Action("revisions.set_parents.toggle_select"):
			return intents.SetParentsToggleSelect{}, true
		}
	case ScopeSquash:
		switch action {
		case keybindings.Action("revisions.squash.ace_jump"):
			return intents.StartAceJump{}, true
		case keybindings.Action("revisions.squash.apply"):
			return intents.Apply{Force: actionargs.BoolArg(args, "force", false)}, true
		case keybindings.Action("revisions.squash.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("revisions.squash.force_apply"):
			return intents.Apply{Force: true}, true
		case keybindings.Action("revisions.squash.interactive"):
			return intents.SquashToggleOption{Option: intents.SquashOptionInteractive}, true
		case keybindings.Action("revisions.squash.jump_to_working_copy"):
			return intents.Navigate{Target: intents.TargetWorkingCopy}, true
		case keybindings.Action("revisions.squash.keep_emptied"):
			return intents.SquashToggleOption{Option: intents.SquashOptionKeepEmptied}, true
		case keybindings.Action("revisions.squash.target_picker"):
			return intents.SquashOpenTargetPicker{}, true
		case keybindings.Action("revisions.squash.use_destination_msg"):
			return intents.SquashToggleOption{Option: intents.SquashOptionUseDestinationMessage}, true
		}
	case ScopeTargetPicker:
		switch action {
		case keybindings.Action("revisions.target_picker.apply"):
			return intents.TargetPickerApply{Force: actionargs.BoolArg(args, "force", false)}, true
		case keybindings.Action("revisions.target_picker.autocomplete"):
			return intents.AutocompleteCycle{}, true
		case keybindings.Action("revisions.target_picker.autocomplete_back"):
			return intents.AutocompleteCycle{Reverse: true}, true
		case keybindings.Action("revisions.target_picker.cancel"):
			return intents.TargetPickerCancel{}, true
		case keybindings.Action("revisions.target_picker.force_apply"):
			return intents.TargetPickerApply{Force: true}, true
		case keybindings.Action("revisions.target_picker.move_down"):
			return intents.TargetPickerNavigate{Delta: 1}, true
		case keybindings.Action("revisions.target_picker.move_up"):
			return intents.TargetPickerNavigate{Delta: -1}, true
		}
	case ScopeRevset:
		switch action {
		case keybindings.Action("revset.apply"):
			return intents.Apply{}, true
		case keybindings.Action("revset.autocomplete"):
			return intents.CompletionCycle{}, true
		case keybindings.Action("revset.autocomplete_back"):
			return intents.CompletionCycle{Reverse: true}, true
		case keybindings.Action("revset.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("revset.edit"):
			return intents.Edit{Clear: actionargs.BoolArg(args, "clear", false)}, true
		case keybindings.Action("revset.move_down"):
			return intents.CompletionMove{Delta: 1}, true
		case keybindings.Action("revset.move_up"):
			return intents.CompletionMove{Delta: -1}, true
		case keybindings.Action("revset.reset"):
			return intents.Reset{}, true
		case keybindings.Action("revset.set"):
			return intents.Set{Value: actionargs.StringArg(args, "value", "")}, true
		}
	case ScopeStatusInput:
		switch action {
		case keybindings.Action("status.input.apply"):
			return intents.Apply{}, true
		case keybindings.Action("status.input.autocomplete"):
			return intents.SuggestCycle{}, true
		case keybindings.Action("status.input.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("status.input.move_down"):
			return intents.SuggestNavigate{Delta: -1}, true
		case keybindings.Action("status.input.move_up"):
			return intents.SuggestNavigate{Delta: 1}, true
		case keybindings.Action("status.input.page_down"):
			return intents.SuggestNavigate{Delta: -1}, true
		case keybindings.Action("status.input.page_up"):
			return intents.SuggestNavigate{Delta: 1}, true
		}
	case ScopeUi:
		switch action {
		case keybindings.Action("ui.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("ui.change_theme"):
			return intents.ChangeTheme{Name: actionargs.StringArg(args, "name", "")}, true
		case keybindings.Action("ui.exec_jj"):
			return intents.ExecJJ{}, true
		case keybindings.Action("ui.exec_shell"):
			return intents.ExecShell{}, true
		case keybindings.Action("ui.expand_status"):
			return intents.ExpandStatusToggle{}, true
		case keybindings.Action("ui.file_search_toggle"):
			return intents.FileSearchToggle{}, true
		case keybindings.Action("ui.open_bookmarks"):
			return intents.OpenBookmarks{}, true
		case keybindings.Action("ui.open_command_history"):
			return intents.CommandHistoryToggle{}, true
		case keybindings.Action("ui.open_git"):
			return intents.OpenGit{}, true
		case keybindings.Action("ui.open_help"):
			return intents.OpenHelp{}, true
		case keybindings.Action("ui.open_oplog"):
			return intents.OpLogOpen{}, true
		case keybindings.Action("ui.open_redo"):
			return intents.Redo{}, true
		case keybindings.Action("ui.open_revset"):
			return intents.Edit{Clear: true}, true
		case keybindings.Action("ui.open_undo"):
			return intents.Undo{}, true
		case keybindings.Action("ui.preview_expand"):
			return intents.PreviewExpand{}, true
		case keybindings.Action("ui.preview_half_page_down"):
			return intents.PreviewScroll{Kind: intents.PreviewHalfPageDown}, true
		case keybindings.Action("ui.preview_half_page_up"):
			return intents.PreviewScroll{Kind: intents.PreviewHalfPageUp}, true
		case keybindings.Action("ui.preview_scroll_down"):
			return intents.PreviewScroll{Kind: intents.PreviewScrollDown}, true
		case keybindings.Action("ui.preview_scroll_up"):
			return intents.PreviewScroll{Kind: intents.PreviewScrollUp}, true
		case keybindings.Action("ui.preview_shrink"):
			return intents.PreviewShrink{}, true
		case keybindings.Action("ui.preview_toggle"):
			return intents.PreviewToggle{}, true
		case keybindings.Action("ui.preview_toggle_bottom"):
			return intents.PreviewToggleBottom{}, true
		case keybindings.Action("ui.quick_search"):
			return intents.QuickSearch{}, true
		case keybindings.Action("ui.quit"):
			return intents.Quit{}, true
		case keybindings.Action("ui.suspend"):
			return intents.Suspend{}, true
		}
	case ScopeUiPreview:
		switch action {
		case keybindings.Action("ui.preview.show"):
			return intents.PreviewShow{Content: actionargs.StringArg(args, "content", "")}, true
		}
	case ScopeUndo:
		switch action {
		case keybindings.Action("undo.apply"):
			return intents.Apply{}, true
		case keybindings.Action("undo.cancel"):
			return intents.Cancel{}, true
		case keybindings.Action("undo.next"):
			return intents.OptionSelect{Delta: 1}, true
		case keybindings.Action("undo.prev"):
			return intents.OptionSelect{Delta: -1}, true
		}
	}
	return nil, false
}

func enumArgDiffArgTarget(args map[string]any, name string) intents.DiffArgTarget {
	var zero intents.DiffArgTarget
	if args == nil {
		return zero
	}
	v, ok := args[name]
	if !ok {
		return zero
	}
	s, ok := v.(string)
	if !ok {
		return zero
	}
	switch s {
	case "to":
		return intents.DiffArgTargetTo
	case "from":
		return intents.DiffArgTargetFrom
	default:
		return zero
	}
}

func enumArgModeTarget(args map[string]any, name string) intents.ModeTarget {
	var zero intents.ModeTarget
	if args == nil {
		return zero
	}
	v, ok := args[name]
	if !ok {
		return zero
	}
	s, ok := v.(string)
	if !ok {
		return zero
	}
	switch s {
	case "onto":
		return intents.ModeTargetDestination
	case "after":
		return intents.ModeTargetAfter
	case "before":
		return intents.ModeTargetBefore
	case "insert":
		return intents.ModeTargetInsert
	default:
		return zero
	}
}

func enumArgRebaseSource(args map[string]any, name string) intents.RebaseSource {
	var zero intents.RebaseSource
	if args == nil {
		return zero
	}
	v, ok := args[name]
	if !ok {
		return zero
	}
	s, ok := v.(string)
	if !ok {
		return zero
	}
	switch s {
	case "revision":
		return intents.RebaseSourceRevision
	case "branch":
		return intents.RebaseSourceBranch
	case "source":
		return intents.RebaseSourceDescendants
	default:
		return zero
	}
}
