"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 editor_query_exports = {};
__export(editor_query_exports, {
  EditorQuery: () => EditorQuery
});
module.exports = __toCommonJS(editor_query_exports);
var import_selection = require("./selection.js");
var import_state = require("./state.js");
var import_style_query = require("./style-query.js");
class EditorQuery {
  // oxlint-disable-next-line no-useless-constructor
  constructor(editor, ricosStyles, converters) {
    this.editor = editor;
    this.ricosStyles = ricosStyles;
    this.converters = converters;
    this.query = {};
    this.addQuery = (name, query) => {
      if (this.query[name]) {
        throw `Query ${name} already exists`;
      }
      this.query[name] = query({ editorQuery: this });
    };
    this._selection = new import_selection.Selection(this.editor, this.converters);
    this._state = new import_state.EditorStateQuery(this.editor, this.converters);
    this._styles = new import_style_query.StylesQuery(this.ricosStyles);
    this.editor.on("transaction", () => {
      this._selection = new import_selection.Selection(this.editor, this.converters);
    });
  }
  selection() {
    return this._selection;
  }
  state() {
    return this._state;
  }
  styles() {
    return this._styles;
  }
}
//# sourceMappingURL=editor-query.js.map
