import { e as b7 } from './index.esm.min-db2d29e8.js';

const store$1 = (() => {
  let _store;
  const setStore = (store) => {
    _store = store;
  };
  const getState = () => {
    return _store && _store.getState();
  };
  const getStore = () => {
    return _store;
  };
  const mapDispatchToProps = (component, props) => {
    Object.keys(props).forEach(actionName => {
      const action = props[actionName];
      Object.defineProperty(component, actionName, {
        get: () => (...args) => _store.dispatch(action(...args)),
        configurable: true,
        enumerable: true,
      });
    });
  };
  const mapStateToProps = (component, mapState) => {
    // TODO: Don't listen for each component
    const _mapStateToProps = (_component, _mapState) => {
      const mergeProps = mapState(_store.getState());
      Object.keys(mergeProps).forEach(newPropName => {
        const newPropValue = mergeProps[newPropName];
        component[newPropName] = newPropValue;
        // TODO: can we define new props and still have change detection work?
      });
    };
    const unsubscribe = _store.subscribe(() => _mapStateToProps());
    _mapStateToProps();
    return unsubscribe;
  };
  return {
    getStore,
    setStore,
    getState,
    mapDispatchToProps,
    mapStateToProps,
  };
})();

class ReduxStoreService {
    constructor() {
        this.mapDispatchToProps = store$1.mapDispatchToProps;
        this.mapStateToProps = store$1.mapStateToProps;
        store$1.setStore(b7());
    }
}
const store = new ReduxStoreService();

export { store as s };
