"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.TOGGLE_SCROLL = exports.SET_SCROLL = exports.SCROLL_SYNC_ENABLED = void 0;
exports.loadScroll = loadScroll;
exports.toggleScroll = toggleScroll;
exports.togglingScroll = togglingScroll;
const SCROLL_SYNC_ENABLED = 'cms.scroll-sync-enabled';
exports.SCROLL_SYNC_ENABLED = SCROLL_SYNC_ENABLED;
const TOGGLE_SCROLL = 'TOGGLE_SCROLL';
exports.TOGGLE_SCROLL = TOGGLE_SCROLL;
const SET_SCROLL = 'SET_SCROLL';
exports.SET_SCROLL = SET_SCROLL;

function togglingScroll() {
  return {
    type: TOGGLE_SCROLL
  };
}

function loadScroll() {
  return {
    type: SET_SCROLL,
    payload: localStorage.getItem(SCROLL_SYNC_ENABLED) !== 'false'
  };
}

function toggleScroll() {
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  return async (dispatch, _getState) => {
    return dispatch(togglingScroll());
  };
}