/*! @docsearch/react 4.5.0-beta.3 | MIT License | © Algolia, Inc. and contributors | https://docsearch.algolia.com */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).DocSearchReact={},e.React)}(this,function(e,t){"use strict";function r(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?n(Object(o),!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}var i={"Ctrl/Cmd+K":!0,"/":!0};e.useDocSearchKeyboardEvents=function(e){var r,n=e.isOpen,c=e.onOpen,a=e.onClose,u=e.isAskAiActive,f=e.onAskAiToggle,s=e.keyboardShortcuts,l=(r=s,o(o({},i),r));t.useEffect(function(){function e(e){var t;if(n&&"Escape"===e.code&&u)f(!1);else{var r=l["Ctrl/Cmd+K"]&&"k"===(null===(t=e.key)||void 0===t?void 0:t.toLowerCase())&&(e.metaKey||e.ctrlKey),o=l["/"]&&"/"===e.key;("Escape"===e.code&&n||r||!function(e){var t=e.composedPath()[0],r=t.tagName;return t.isContentEditable||"INPUT"===r||"SELECT"===r||"TEXTAREA"===r}(e)&&o&&!n)&&(e.preventDefault(),n?a():document.body.classList.contains("DocSearch--active")||c())}}return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}},[n,c,a,u,f,l])}});
//# sourceMappingURL=useDocSearchKeyboardEvents.js.map
