"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 plugins_events_exports = {};
__export(plugins_events_exports, {
  PluginsEvents: () => PluginsEvents
});
module.exports = __toCommonJS(plugins_events_exports);
const LAYOUT_SHIFT_TOPIC = "ricos.plugins.sideEffect.layoutShift";
const TOPICS = [
  "ricos.plugins.functionality.pluginAddSuccess",
  "ricos.plugins.functionality.pluginAdd",
  "ricos.plugins.functionality.pluginDelete",
  "ricos.plugins.functionality.pluginToolbarButtonClick",
  "ricos.plugins.functionality.pluginPopoverClick",
  "ricos.plugins.functionality.pluginPopoverTabSwitch",
  "ricos.plugins.functionality.pluginPopoverSearch",
  "ricos.plugins.functionality.pluginChangeSettings",
  "ricos.plugins.functionality.pluginLinkable",
  "ricos.plugins.functionality.mediaPluginsDetails",
  "ricos.plugins.table.addColumnRow",
  "ricos.plugins.table.deleteColumnRow",
  "ricos.plugins.table.contextMenuClick",
  "ricos.plugins.table.contextMenuOptionClick",
  LAYOUT_SHIFT_TOPIC,
  "ricos.plugins.functionality.modalAction",
  "ricos.toolbars.functionality.buttonClick"
];
class PluginsEvents {
  constructor() {
    this.topicsToPublish = TOPICS;
    this.topicsToSubscribe = [LAYOUT_SHIFT_TOPIC];
  }
  publishPluginAddSuccess({
    pluginId,
    params
  }) {
    return this.publishers.byTopic("ricos.plugins.functionality.pluginAddSuccess").publish({ pluginId, params });
  }
  publishPluginAdd({
    pluginId,
    entryPoint
  }) {
    return this.publishers.byTopic("ricos.plugins.functionality.pluginAdd").publish({ pluginId, entryPoint });
  }
  publishPluginDelete({ pluginId }) {
    return this.publishers.byTopic("ricos.plugins.functionality.pluginDelete").publish({ pluginId });
  }
  publishPluginToolbarClick({
    pluginId,
    buttonName,
    value,
    nodeId,
    type
  }) {
    return this.publishers.byTopic("ricos.plugins.functionality.pluginToolbarButtonClick").publish({ pluginId, buttonName, value, nodeId, type: type ?? "PLUGIN" });
  }
  publishPluginPopoverClick({ pluginId, buttonName }) {
    return this.publishers.byTopic("ricos.plugins.functionality.pluginPopoverClick").publish({ pluginId, buttonName });
  }
  publishPluginPopoverTabSwitch({
    pluginId,
    buttonName
  }) {
    return this.publishers.byTopic("ricos.plugins.functionality.pluginPopoverTabSwitch").publish({ pluginId, buttonName });
  }
  publishPluginPopoverSearch({ pluginId, searchTerm }) {
    return this.publishers.byTopic("ricos.plugins.functionality.pluginPopoverSearch").publish({ pluginId, searchTerm });
  }
  publishPluginChangeSettings({
    pluginId,
    nodeId,
    actionName,
    value
  }) {
    return this.publishers.byTopic("ricos.plugins.functionality.pluginChangeSettings").publish({ pluginId, nodeId, actionName, value });
  }
  publishPluginLinkable({
    pluginId,
    nodeId,
    category,
    link,
    nofollow,
    noreferrer,
    newTab,
    anchor
  }) {
    return this.publishers.byTopic("ricos.plugins.functionality.pluginLinkable").publish({ pluginId, nodeId, category, link, nofollow, noreferrer, newTab, anchor });
  }
  publishModalAction({
    pluginId,
    actionName,
    value,
    modalSessionId,
    modalId,
    actionNumber,
    initialSelection,
    style
  }) {
    return this.publishers.byTopic("ricos.plugins.functionality.modalAction").publish({
      pluginId,
      actionName,
      value,
      modalSessionId,
      modalId,
      actionNumber,
      initialSelection,
      style
    });
  }
  publishTableAddRowCol({
    pluginId,
    nodeId,
    category,
    location,
    source
  }) {
    return this.publishers.byTopic("ricos.plugins.table.addColumnRow").publish({ pluginId, nodeId, category, location, source });
  }
  publishTableContextMenuClick({
    pluginId,
    nodeId
  }) {
    return this.publishers.byTopic("ricos.plugins.table.contextMenuClick").publish({ pluginId, nodeId });
  }
  publishTableDeleteColumnRow({
    pluginId,
    nodeId,
    category
  }) {
    return this.publishers.byTopic("ricos.plugins.table.deleteColumnRow").publish({ pluginId, nodeId, category });
  }
  publishTableContextMenuOptionClick({
    pluginId,
    nodeId,
    category,
    actionName
  }) {
    return this.publishers.byTopic("ricos.plugins.table.contextMenuOptionClick").publish({ pluginId, nodeId, category, actionName });
  }
  publishMediaPluginsDetails({
    pluginId,
    nodeId,
    creator,
    title,
    track_duration,
    type,
    url
  }) {
    return this.publishers.byTopic("ricos.plugins.functionality.mediaPluginsDetails").publish({ pluginId, nodeId, creator, title, track_duration, type, url });
  }
  publishPluginLayoutShift({ nodeId }) {
    return this.publishers.byTopic(LAYOUT_SHIFT_TOPIC).publish({ nodeId });
  }
  onPluginLayoutShift(callback) {
    return this.subscriptors.byTopic(LAYOUT_SHIFT_TOPIC).subscribe(callback);
  }
}
//# sourceMappingURL=plugins-events.js.map
