import { createDragDropActions as a } from "../actions/dragDrop/index.js";
class p {
  receiveBackend(t) {
    this.backend = t;
  }
  getMonitor() {
    return this.monitor;
  }
  getBackend() {
    return this.backend;
  }
  getRegistry() {
    return this.monitor.registry;
  }
  getActions() {
    const t = this, { dispatch: r } = this.store;
    function e(s) {
      return (...i) => {
        const n = s.apply(t, i);
        typeof n < "u" && r(n);
      };
    }
    const o = a(this);
    return Object.keys(o).reduce((s, i) => {
      const n = o[i];
      return s[i] = e(n), s;
    }, {});
  }
  dispatch(t) {
    this.store.dispatch(t);
  }
  constructor(t, r) {
    this.isSetUp = !1, this.handleRefCountChange = () => {
      const e = this.store.getState().refCount > 0;
      this.backend && (e && !this.isSetUp ? (this.backend.setup(), this.isSetUp = !0) : !e && this.isSetUp && (this.backend.teardown(), this.isSetUp = !1));
    }, this.store = t, this.monitor = r, t.subscribe(this.handleRefCountChange);
  }
}
export {
  p as DragDropManagerImpl
};
//# sourceMappingURL=DragDropManagerImpl.js.map
