"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
require("core-js/modules/es.array.iterator.js");
require("core-js/modules/web.dom-collections.iterator.js");
var _react = require("react");
var _useMergedState = _interopRequireDefault(require("rc-util/es/hooks/useMergedState"));
function useMountMergeState(initialState, option) {
  const mountRef = (0, _react.useRef)(false);
  (0, _react.useEffect)(() => {
    mountRef.current = true;
    return () => {
      mountRef.current = false;
    };
  });
  const [state, setState] = (0, _useMergedState.default)(initialState, option);
  const mountSetState = prevState => {
    requestAnimationFrame(() => {
      if (mountRef.current) {
        setState(prevState);
      }
    });
  };
  return [state, mountSetState];
}
var _default = useMountMergeState;
exports.default = _default;