"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 content_query_service_exports = {};
__export(content_query_service_exports, {
  RicosContentQueryService: () => RicosContentQueryService
});
module.exports = __toCommonJS(content_query_service_exports);
var import_extract = require("./../ricos-content/lib/extract.js");
class GetContentExtractorError extends Error {
}
class RicosContentQueryService {
  setEditor(editor, converters) {
    this.editor = editor;
    this.converters = converters;
  }
  getContentExtractor() {
    if (!this.editor) {
      throw new GetContentExtractorError(
        "getContentExtractor called without initialize editor instance (setEditor)"
      );
    }
    const tiptapContent = this.editor.getJSON();
    const richContent = this.converters.fromPm(tiptapContent);
    const nodes = richContent.nodes;
    return (0, import_extract.extract)(nodes ?? []);
  }
}
//# sourceMappingURL=content-query-service.js.map
