"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var InputService_exports = {};
__export(InputService_exports, {
  InputService: () => InputService
});
module.exports = __toCommonJS(InputService_exports);
var import_inputParsing = require("../utils/inputParsing.js");
class InputService {
  /**
   * Detects what type of autocomplete should be shown
   */
  detectAutocompleteType(input) {
    return (0, import_inputParsing.detectAutocompleteType)(input);
  }
  /**
   * Extracts slash command query
   */
  extractSlashQuery(input) {
    return (0, import_inputParsing.extractSlashQuery)(input);
  }
  /**
   * Extracts resource mention query
   */
  extractResourceQuery(input) {
    return (0, import_inputParsing.extractResourceQuery)(input);
  }
  /**
   * Parses input
   */
  parseInput(input) {
    return (0, import_inputParsing.parseInput)(input);
  }
  /**
   * Deletes word backward from cursor position
   */
  deleteWordBackward(text, cursorPos = text.length) {
    if (cursorPos === 0) return text;
    let pos = cursorPos - 1;
    while (pos >= 0) {
      const char = text[pos];
      if (char && !/\s/.test(char)) break;
      pos--;
    }
    while (pos >= 0) {
      const char = text[pos];
      if (char && /\s/.test(char)) break;
      pos--;
    }
    const deleteStart = pos + 1;
    return text.slice(0, deleteStart) + text.slice(cursorPos);
  }
  /**
   * Deletes word forward from cursor position
   */
  deleteWordForward(text, cursorPos = text.length) {
    if (cursorPos >= text.length) return text;
    let pos = cursorPos;
    while (pos < text.length) {
      const char = text[pos];
      if (char && !/\s/.test(char)) break;
      pos++;
    }
    while (pos < text.length) {
      const char = text[pos];
      if (char && /\s/.test(char)) break;
      pos++;
    }
    return text.slice(0, cursorPos) + text.slice(pos);
  }
  /**
   * Deletes entire line (for single-line input)
   */
  deleteLine(_text) {
    return "";
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  InputService
});
