import { registerEditorAction, EditorAction2, EditorAction } from '../../../browser/editorExtensions.js';
import { KeyCode } from '../../../../base/common/keyCodes.js';
import { localize2WithPath, localizeWithPath } from '../../../../nls.js';
import { KeybindingWeight } from '../../../../platform/keybinding/common/keybindingsRegistry.js';
import { StandaloneColorPickerController } from './standaloneColorPickerWidget.js';
import { EditorContextKeys } from '../../../common/editorContextKeys.js';
import { registerAction2, MenuId } from '../../../../platform/actions/common/actions.js';
import './colorPicker.css.js';
const _moduleId = "vs/editor/contrib/colorPicker/browser/standaloneColorPickerActions";
class ShowOrFocusStandaloneColorPicker extends EditorAction2 {
    constructor() {
        super({
            id: 'editor.action.showOrFocusStandaloneColorPicker',
            title: {
                ...( localize2WithPath(_moduleId, 0, "Show or Focus Standalone Color Picker")),
                mnemonicTitle: ( localizeWithPath(_moduleId, 1, "&&Show or Focus Standalone Color Picker")),
            },
            precondition: undefined,
            menu: [
                { id: MenuId.CommandPalette },
            ],
            metadata: {
                description: ( localize2WithPath(
                    _moduleId,
                    2,
                    "Show or focus a standalone color picker which uses the default color provider. It displays hex/rgb/hsl colors."
                )),
            }
        });
    }
    runEditorCommand(_accessor, editor) {
        StandaloneColorPickerController.get(editor)?.showOrFocus();
    }
}
class HideStandaloneColorPicker extends EditorAction {
    constructor() {
        super({
            id: 'editor.action.hideColorPicker',
            label: ( localizeWithPath(_moduleId, 3, "Hide the Color Picker")),
            alias: 'Hide the Color Picker',
            precondition: ( (EditorContextKeys.standaloneColorPickerVisible.isEqualTo(true))),
            kbOpts: {
                primary: KeyCode.Escape,
                weight: KeybindingWeight.EditorContrib
            },
            metadata: {
                description: ( localize2WithPath(_moduleId, 4, "Hide the standalone color picker.")),
            }
        });
    }
    run(_accessor, editor) {
        StandaloneColorPickerController.get(editor)?.hide();
    }
}
class InsertColorWithStandaloneColorPicker extends EditorAction {
    constructor() {
        super({
            id: 'editor.action.insertColorWithStandaloneColorPicker',
            label: ( localizeWithPath(_moduleId, 5, "Insert Color with Standalone Color Picker")),
            alias: 'Insert Color with Standalone Color Picker',
            precondition: ( (EditorContextKeys.standaloneColorPickerFocused.isEqualTo(true))),
            kbOpts: {
                primary: KeyCode.Enter,
                weight: KeybindingWeight.EditorContrib
            },
            metadata: {
                description: ( localize2WithPath(
                    _moduleId,
                    6,
                    "Insert hex/rgb/hsl colors with the focused standalone color picker."
                )),
            }
        });
    }
    run(_accessor, editor) {
        StandaloneColorPickerController.get(editor)?.insertColor();
    }
}
registerEditorAction(HideStandaloneColorPicker);
registerEditorAction(InsertColorWithStandaloneColorPicker);
registerAction2(ShowOrFocusStandaloneColorPicker);
export { ShowOrFocusStandaloneColorPicker };
