"use strict";

exports.__esModule = true;
exports.default = void 0;

var _react = require("react");

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};

var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};

var defaultPredicate = function defaultPredicate(previous, current) {
  return previous !== undefined && previous !== null && previous !== current;
};

var usePreviousModified = function usePreviousModified(value, effectAction, predicate) {
  if (effectAction === void 0) {
    effectAction = null;
  }

  if (predicate === void 0) {
    predicate = defaultPredicate;
  }

  var ref = (0, _react.useRef)(value);
  var predicateResult = predicate(ref.current, value);
  (0, _react.useEffect)(function () {
    if (effectAction != null && predicateResult) {
      effectAction(value, ref.current);
    }

    ref.current = value;
  }, [value]); // eslint-disable-line react-hooks/exhaustive-deps

  return predicateResult;
};

__signature__(usePreviousModified, "useRef{ref}\nuseEffect{}");

__signature__(usePreviousModified, "useRef{ref}\nuseEffect{}");

var _default = usePreviousModified;
var _default2 = _default;
var _default3 = _default2;
exports.default = _default3;
;

(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(defaultPredicate, "defaultPredicate", "/home/vsts/work/1/s/src/hooks/usePreviousModified.js");
  reactHotLoader.register(usePreviousModified, "usePreviousModified", "/home/vsts/work/1/s/src/hooks/usePreviousModified.js");
  reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/hooks/usePreviousModified.js");
})();

;

(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();

;

(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(defaultPredicate, "defaultPredicate", "/home/vsts/work/1/s/src/hooks/usePreviousModified.js");
  reactHotLoader.register(usePreviousModified, "usePreviousModified", "/home/vsts/work/1/s/src/hooks/usePreviousModified.js");
  reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/hooks/usePreviousModified.js");
})();

;

(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();