/**
 * @license
 * Copyright 2025 Vybestack LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import { CommandKind, } from './types.js';
import { isMouseEventsActive, setMouseEventsActive } from '../utils/mouse.js';
function parseMouseCommandMode(args) {
    const normalized = args.trim().toLowerCase();
    if (!normalized || normalized === 'toggle')
        return 'toggle';
    if (normalized === 'on' || normalized === 'enable')
        return 'on';
    if (normalized === 'off' || normalized === 'disable')
        return 'off';
    return null;
}
export const mouseCommand = {
    name: 'mouse',
    description: 'Toggle mouse event tracking (enables in-app wheel scrolling and in-app selection/copy)',
    kind: CommandKind.BUILT_IN,
    action: async (_context, args) => {
        const mode = parseMouseCommandMode(args);
        if (!mode) {
            return {
                type: 'message',
                messageType: 'error',
                content: 'Usage: /mouse [on|off|toggle]',
            };
        }
        const currentlyActive = isMouseEventsActive();
        const nextActive = mode === 'toggle' ? !currentlyActive : mode === 'on' ? true : false;
        setMouseEventsActive(nextActive);
        return {
            type: 'message',
            messageType: 'info',
            content: nextActive
                ? 'Mouse events enabled (wheel scrolling + in-app selection/copy on).'
                : 'Mouse events disabled (terminal selection/copy on; in-app wheel scrolling off).',
        };
    },
};
//# sourceMappingURL=mouseCommand.js.map