var c = Object.defineProperty;
var i = (e, r, t) => r in e ? c(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t;
var s = (e, r, t) => i(e, typeof r != "symbol" ? r + "" : r, t);
import { ReplaySubject as R } from "./index-ReplaySubject.js";
const a = "PubSub Service";
class C {
  constructor() {
    s(this, "events", {});
  }
  /**
   * a void function when we don't want to use the subscription from 'RxJs';
   * @param {event} event - the specific name to subscribe on - the names must be specific to those we publish.
   * @param {(value: any) => void} callback - callback function
   * @param {(error: any) => void} error - exception catch function
   * @param {() => void} complete - complete function
   */
  $sub(r, t, A, o) {
    if (!r)
      throw new Error(`[${a}] => Subscription method must get event name.`);
    return this.events[r] === void 0 && (this.events[r] = new R()), typeof t != "function" ? this.events[r].asObservable() : this.events[r].asObservable().subscribe(t, A, o);
  }
  /**
   * Base Module needed to use PubSubService.
   * @param {event} event - the specific name to subscribe on
   * @param {eventObject} eventObject - the optional paramter to send when raising the event
   */
  $pub(r, t) {
    if (r) {
      if (!this.events[r])
        return;
    } else throw new Error(`[${a}] => Publish method must get event name.`);
    this.events[r].next(t);
  }
}
const b = new C();
var n;
(function(e) {
  e.reactModalOpen = "REACT_MODAL_OPEN", e.reactModalClose = "REACT_MODAL_CLOSE", e.reactSnackbarOpen = "REACT_SNACKBAR_OPEN", e.reactSnackbarClose = "REACT_SNACKBAR_CLOSE", e.reactActionBarAddMessage = "REACT_ACTION_BAR_ADD", e.reactActionBarRemoveMessage = "REACT_ACTION_BAR_REMOVE", e.reactActionBarSetFooter = "REACT_ACTION_BAR_SET_FOOTER", e.reactActionBarHideFooter = "REACT_ACTION_BAR_HIDE_FOOTER", e.reactDrawerOpen = "REACT_DRAWER_OPEN", e.reactDrawerClose = "REACT_DRAWER_CLOSE";
})(n || (n = {}));
export {
  n as PUB_SUB_EVENTS,
  b as pubSubService
};
