"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const platform = require("../../../../platform/registry/common/platform.js");
const quickAccess = require("../../../../platform/quickinput/common/quickAccess.js");
const standaloneStrings = require("../../../common/standaloneStrings.js");
const codeEditorService = require("../../../browser/services/codeEditorService.js");
const commandsQuickAccess = require("../../../contrib/quickAccess/browser/commandsQuickAccess.js");
const types = require("../../../../base/common/types.js");
const instantiation = require("../../../../platform/instantiation/common/instantiation.js");
const keybinding = require("../../../../platform/keybinding/common/keybinding.js");
const commands = require("../../../../platform/commands/common/commands.js");
const telemetry = require("../../../../platform/telemetry/common/telemetry.js");
const dialogs = require("../../../../platform/dialogs/common/dialogs.js");
const editorExtensions = require("../../../browser/editorExtensions.js");
const editorContextKeys = require("../../../common/editorContextKeys.js");
const quickInput = require("../../../../platform/quickinput/common/quickInput.js");
var __decorate = globalThis && globalThis.__decorate || function(decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
    r = Reflect.decorate(decorators, target, key, desc);
  else
    for (var i = decorators.length - 1; i >= 0; i--)
      if (d = decorators[i])
        r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __param = globalThis && globalThis.__param || function(paramIndex, decorator) {
  return function(target, key) {
    decorator(target, key, paramIndex);
  };
};
var __awaiter = globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
  function adopt(value) {
    return value instanceof P ? value : new P(function(resolve) {
      resolve(value);
    });
  }
  return new (P || (P = Promise))(function(resolve, reject) {
    function fulfilled(value) {
      try {
        step(generator.next(value));
      } catch (e) {
        reject(e);
      }
    }
    function rejected(value) {
      try {
        step(generator["throw"](value));
      } catch (e) {
        reject(e);
      }
    }
    function step(result) {
      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
    }
    step((generator = generator.apply(thisArg, _arguments || [])).next());
  });
};
exports.StandaloneCommandsQuickAccessProvider = class StandaloneCommandsQuickAccessProvider extends commandsQuickAccess.AbstractEditorCommandsQuickAccessProvider {
  constructor(instantiationService, codeEditorService2, keybindingService, commandService, telemetryService, dialogService) {
    super({ showAlias: false }, instantiationService, keybindingService, commandService, telemetryService, dialogService);
    this.codeEditorService = codeEditorService2;
  }
  get activeTextEditorControl() {
    return types.withNullAsUndefined(this.codeEditorService.getFocusedCodeEditor());
  }
  getCommandPicks() {
    return __awaiter(this, void 0, void 0, function* () {
      return this.getCodeEditorCommandPicks();
    });
  }
};
exports.StandaloneCommandsQuickAccessProvider = __decorate([
  __param(0, instantiation.IInstantiationService),
  __param(1, codeEditorService.ICodeEditorService),
  __param(2, keybinding.IKeybindingService),
  __param(3, commands.ICommandService),
  __param(4, telemetry.ITelemetryService),
  __param(5, dialogs.IDialogService)
], exports.StandaloneCommandsQuickAccessProvider);
platform.Registry.as(quickAccess.Extensions.Quickaccess).registerQuickAccessProvider({
  ctor: exports.StandaloneCommandsQuickAccessProvider,
  prefix: exports.StandaloneCommandsQuickAccessProvider.PREFIX,
  helpEntries: [{ description: standaloneStrings.QuickCommandNLS.quickCommandHelp, needsEditor: true }]
});
class GotoLineAction extends editorExtensions.EditorAction {
  constructor() {
    super({
      id: "editor.action.quickCommand",
      label: standaloneStrings.QuickCommandNLS.quickCommandActionLabel,
      alias: "Command Palette",
      precondition: void 0,
      kbOpts: {
        kbExpr: editorContextKeys.EditorContextKeys.focus,
        primary: 59,
        weight: 100
        /* EditorContrib */
      },
      contextMenuOpts: {
        group: "z_commands",
        order: 1
      }
    });
  }
  run(accessor) {
    accessor.get(quickInput.IQuickInputService).quickAccess.show(exports.StandaloneCommandsQuickAccessProvider.PREFIX);
  }
}
editorExtensions.registerEditorAction(GotoLineAction);
exports.GotoLineAction = GotoLineAction;
