"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),t=require("react");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function n(e){if(e&&"object"==typeof e&&"default"in e)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var u=r(e),o=n(t);exports.useKeyPress=function(e,t,r){var n=o.useState(!1),i=u.default(n,2),f=i[0],c=i[1],a=function(r){r.key===e&&(t?t(r):c(!0))},d=function(t){t.key===e&&(r?r(t):c(!1))};return o.useEffect((function(){return window.addEventListener("keydown",a),window.addEventListener("keyup",d),function(){window.removeEventListener("keydown",a),window.removeEventListener("keyup",d)}}),[e,t,r]),f};
